Objects and Classes

When people talk about objects, they can be talking about one of two things. When some people, for example C programmers, talk about object-oriented programming, they are are talking about objects (or classes) as data structures with certain properties or attributes. These are roughly analogous to the tables in a database, with their associated fields.

As a very simple example, you might have a time object, with two attributes being hours and minutes. All of the functions and operators that you are going to use on a time will need to be aware of how the time object is constructed - they will need to know that the hours and minutes will need to be added separately, and that if there are more than 59 minutes, then the hours will need to be incremented, etc. Once these functions have been created, the time object will be treated as a whole object, and you can add times, compare times, etc.

On the other hand, web-designers and Visual Basic programmers refer to controls on the screen, or images, frames, etc., as objects. These objects are not created by the programmer, but they can still be controlled by properties and methods (although these are pre-defined).

I have written a blog on Object-Oriented Programming in Python (with an accompanying video).

Properties

Properties are the object's attributes, and can be thought of as variables (although some may be read-only). In the above time object, hours and minutes are properties. In a Visual Basic object such as a form or a button, the properties will be for things such as positions on the x- and y-axes, or whether the control is visible. These properties can either be set at design-time, or changed as the program is running.

Methods

Methods are the functions that can be used on an object (C/C++ programmers can also update operators to work with new objects - this is known as operator overloading). Properties for Visual Basic includes functions such as Hide, Unhide and Refresh.