When the constructor dynamically allocates memory, a destructor must be added to return the memory to the free pool when an object gets cleaned up. The assignment operator is called when one instance of a class is assigned to another. The copy constructor defines the behaviour of the class when it is passed by value as an argument, returned by value from a function, or used to initialize one instance with the value of another class instance. Defining this constructor, all the class objects are copied properly. In this case a comment line should state that they were omitted by purpose.
Inline expansion avoids the overhead of a function call and can result in savings of CPU time.
It is recommended to use access functions only when needed and not by default. The use of global variables or functions should be avoided where possible, in order to respect encapsulation . The use of friend classes should be avoided where possible. To guarantee the encapsulation of a base class is always preferable to use protected data over friends or public data and then use inheritance. The use of type casting should be avoided .