What is class invariant?



What is class invariant?..

Answer / subham chaudhary

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.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the difference between operator new and the new operator?

3 Answers   Amazon, TCS, Wipro,


What is auto type c++?

0 Answers  


Can we make copy constructor private in c++?

0 Answers  


advantages and disadvantages of using Borland C++ / version 5.

1 Answers  


Is c++ a high level language?

0 Answers  


What does '\r' and '\b' mean? Please explain with example.

7 Answers  


Please explain the reference variable in c++?

0 Answers  


Why is c++ still used?

0 Answers  


Is java easier than c++?

0 Answers  


What do you mean by abstraction in C++?

1 Answers  


What are the conditions that have to be met for a condition to be an invariant of the class?

1 Answers  


Write a program which uses Command Line Arguments

0 Answers  


Categories