Name | Checked | Synopsis |
---|
OOP#001
|
 |
A class that manages resources shall declare a copy constructor, a copy assignment operator, and a destructor |
OOP#002
|
|
A public method must never return a non-const reference or pointer to member data |
OOP#003
|
|
A public method must never return a non-const reference or pointer to data outside an object, unless the object shares the data with other objects |
OOP#004
|
 |
Derive from more than one base class with the same parent with care |
OOP#005
|
|
Do use references for associations with cardinality '1' whenever possible |
OOP#006
|
 |
A function should not return a raw pointer |
OOP#007
|
|
Selection statements (if-else and switch) should be used when the control flow depends on an object's value; dynamic binding should be used when the control flow depends on the object's type |
OOP#008
|
 |
Encapsulate global variables and constants, enumerated types, and typedefs in a class or in a namespace |
OOP#009
|
|
Avoid inheritance for parts-of relations |
OOP#010
|
 |
Avoid multiple inheritance |
OOP#011
|
 |
Never redefine an inherited non-virtual method |
OOP#012
|
|
Use C++ to describe preconditions, postconditions, exceptions, and class invariants |
OOP#013
|
 |
A base class destructor should be either public and virtual, or protected and non-virtual |
OOP#014
|
|
Document the interface of template parameters |
OOP#015
|
 |
Friends of a class should be avoided |
OOP#016
|
|
Specify functions using preconditions, postconditions, exceptions; specify classes using invariants |
OOP#017
|
|
It shall be possible to use a pointer or reference to an object of a derived class wherever a pointer or reference to a public base class object is used |
OOP#018
|
 |
When overriding a (virtual) function from a base class, the derived class should give the same const modifier to the function. |