October 2004
Intermediate to advanced
624 pages
16h 2m
English
Member variables (also known as fields) are data that are part of an object or, in the case of static member variables, belong to a class. Methods are functions that belong to object instances or, in the case of static methods, to a class. Several modern languages (C#, D, Delphi) support the concept of a property. Though using a property is syntactically the same as accessing member variables, properties are different to C++ member variables in that using them may actually involve a function call. For example, property definitions might look like[1] the Date class shown in Listing 35.1.
Example 35.1.
class Date { public: enum WeekDay { Sunday, Monday, ... }; public: property WeekDay get_DayOfWeek() const; property int get_DayOfMonth() ...Read now
Unlock full access