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

Why is "using namespace std;" considered bad practice?

0 Answers  


What are the debugging methods you use when came across a problem?

1 Answers  


Is c++ a good beginners programming language?

0 Answers  


Difference between Constructors and static constructors?

3 Answers   IBM, TCS,


Should a constructor be public or private?

0 Answers  






Write a C++ Program to check whether a number is prime number or not?

0 Answers   IBS,


Name some pure object oriented languages?

1 Answers  


write a porgram in c++ that reads an integer and print the biggest digit in the number

0 Answers  


what is the C++

1 Answers   Wipro,


Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h

0 Answers  


What are the data types in c++?

0 Answers  


What is the output of printf("%d")?

58 Answers   CTS, HCL, Infosys, TCS, Winit, Wipro,


Categories