The // Attributes Comment
| Overview | How Do I | | Tutorial
The // Attributes
section of an MFC class declaration contains the public attributes (or properties) of the object. Typically these are member variables, or Get/Set functions. The "Get" and "Set" functions may or may not be virtual. The "Get" functions are usually const, because in most cases they don't have side effects. These members are normally public; protected and private attributes are typically found in the implementation section.
In the sample listing from class CStdioFile, under An Example of the Comments, the list includes one member variable, m_pStream. Class CDC lists nearly 20 members under this comment.
Note Large classes, such as CDC and CWnd, may have so many members that simply listing all of the attributes in one group would not add much to clarity. In such cases, the class library uses other comments as headings to further delineate the members. For example, CDC uses // Device-Context Functions
, // Drawing Tool Functions
, // Drawing Attribute Functions
, and more. Groups that represent attributes will follow the usual syntax described above. Many of the OLE classes have an implementation section called // Interface Maps
.