Adding Properties and Methods to a Class

See Also

The properties and methods of a class make up its default interface. The default interface is the most common way of manipulating an object.

In general, properties represent data about an object, while methods represent actions an object can take. To put it another way, properties provide the description of an object, while methods are its behavior.

The following topics describe the mechanisms for adding properties and methods to your classes, and address some of the issues you'll meet.

Important   The following names cannot be used as property or method names, because they belong to the underlying IUnknown and IDispatch interfaces: QueryInterface, AddRef, Release, GetTypeInfoCount, GetTypeInfo, GetIDsOfNames, and Invoke. These names will cause a compilation error.

For More Information   Events are discussed in "Adding Events to a Class" later in this chapter.