C++ Programming Question:
Download Questions PDF

What is class invariant in C++?

C++ Programming Interview Question
C++ Programming Interview Question

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.

Download C++ Programming Interview Questions And Answers PDF

Previous QuestionNext Question
What is a Null object in C++?What do you mean by Stack unwinding in C++?