Next: 3.2 Constructors and Destructors  Up: 3 Class  Previous: 3 Class  Contents

3.1 General

3.1.1

High Integrity CPP Rule

Organise 'class' definitions by access level, in the following order : 'public', 'protected', 'private'.

3.1.2

High Integrity CPP Rule

Define class type variables using direct initialisation rather than copy initialisation.

3.1.3

High Integrity CPP Rule

Declare or define a copy constructor, a copy assignment operator and a destructor for classes which manage resources.

3.1.4

High Integrity CPP Rule

Use an atomic, non-throwing swap operation to implement the copy-assignment operator ('operator=')

3.1.5

High Integrity CPP Rule

Ensure copy assignment is implemented correctly in terms of self assignment, inheritance, resource management and behaves consistently with the built in assignment operator.

3.1.6

High Integrity CPP Rule

Do not inline virtual functions.

3.1.7

High Integrity CPP Guideline

Do not use the 'inline' keyword for member functions, inline functions by defining them in the class body.

3.1.8

High Integrity CPP Rule

Declare 'const' any class member function that does not modify the externally visible state of the object.

3.1.9

High Integrity CPP Guideline

Behaviour should be implemented by only one member function in a class.

3.1.10

High Integrity CPP Rule

Do not declare conversion operators to fundamental types.

3.1.11

High Integrity CPP Rule

Do not provide conversion operators for class types.

3.1.12

High Integrity CPP Guideline

Provide an output operator ('operator<<') for ostream for all classes.

3.1.13

High Integrity CPP Guideline

Verify that all classes provide a minimal standard interface against a checklist comprising: a default constructor; a copy constructor; a copy assignment operator and a destructor.


HICPP VERSION 2.4  http://www.codingstandard.com   Copyright: © 2007 THE PROGRAMMING RESEARCH GROUP