Partager via


// Attributes Comment

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 do not 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 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 OLE classes have an implementation section called // Interface Maps.

See Also

Concepts

Using the MFC Source Files

An Example of the Comments

// Implementation Comment

// Constructors Comment

// Operations Comment

// Overridables Comment