What is class invariant?
Page 1 of 1
What is class invariant?
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.
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.
Similar topics
» What are the conditions that have to be met for a condition to be an invariant of the class?
» What is an adaptor class or Wrapper class?
» Differentiate between a template class and class template.
» What is an Iterator class?
» What is a protocol class?
» What is an adaptor class or Wrapper class?
» Differentiate between a template class and class template.
» What is an Iterator class?
» What is a protocol class?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum