+

Search Tips | Advanced Search

C++ methods and attributes

Method names are in mixed case. Various considerations apply to parameters and return values. Attributes are accessed using set and get methods as appropriate.

Parameters of methods that are const are for input only. Parameters with signatures including a pointer (*) or a reference (&) are passed by reference. Return values that do not include a pointer or a reference are passed by value; in the case of returned objects, these are new entities that become the responsibility of the caller.

Some method signatures include items that take a default if not specified. Such items are always at the end of signatures and are denoted by an equal sign (=); the value after the equal sign indicates the default value that applies if the item is omitted.

All method names in these classes are mixed case, beginning with lowercase. Each word, except the first within a method name, begins with a capital letter. Abbreviations are not used unless their meaning is widely understood. Abbreviations used include id (for identity) and sync (for synchronization).

Object attributes are accessed using set and get methods. A set method begins with the word set ; a get method has no prefix. If an attribute is read-only, there is no set method.

Attributes are initialized to valid states during object construction, and the state of an object is always consistent.

Parent topic: C++ language considerations

Last updated: 2020-10-04