[Next] [Prev] [Up] [Top]

6.0 Style

Classes


6.1.1 Class names start with C, T, M, S, or P. (R)

These naming conventions are based upon inheritance constructs described in the first part of the next section.

Mixin classes, which must have no parent classes, begin with an "M". These classes usually do not have data members. They also usually do not have destructors.

Simple classes, which have extremely limited functionality and are not meant to have descendents, do not derive from TObject/CObject and have names beginning with an "S". These classes often have all their methods inline.

For the PC, all class names should begin with either a C for CObject derivatives, an S for non-CObject derivatives, or an M for mixins. No others are allowed.

Examples:

CButtonManager

MScrollable

For Unix, all class names should begin with a capital T, M, S or P. No others are allowed.

Most class names should begin with a T, indicating that it is a TObject descendent.

The P classes are a very special case and are reserved for use by the Poi database classes.

Examples:

TButtonManager

SPushDraw

6.1.2 Data Members start with an "f". (R)

All class data members should start with a lowercase "f", followed by an uppercase letter for the first significant letter of the data member name.

Examples:

class X

{

public:

...

protected:

int fRowCount;

TMyTable fTable;

};

For systems which generate code in a fixed convention, there is no requirement to post edit the code to follow this convention.

6.1.3 Method names should begin with a lowercase. (R)

All class methods, whether static or not, should begin with a lower case letter. Capitalization is reserved for global (non-class) functions.

6.1.4 Class internals should be in the order: public, protected, then private in the interface files. (GL)

The example below should clarify this:

class X {

public:

constructors

destructors

public methods

protected:

protected data

protected methods

private:

private data

private methods

}; // X


No Title
[Next] [Prev] [Up] [Top]

Generated with CERN WebMaker

This site was grabbed using the TRIAL version of Grab-a-Site. This message does not appear on a licensed copy of Grab-a-Site.