Interviews1 answer
What is class invariant?
Posted Jul 12, 2006, 9:49 PM EDTOOP/OOD
1 Answer
A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class..
its_yogeshPosted Jul 13, 2006, 3:15 AM EDT