Class Invariant:
-It is a condition that ensures correct working of a class and defines all the valid states for an object.
When an object is created class invariants must hold.
It is necessary for them to be preserved under all operations of the class.
All class invariants are both preconditions as well as post-conditions for all operations or member functions of the class.