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 #include cmath?

0 Answers  


What do you mean by function overriding & function overloading in c++?

0 Answers  


check whether a no is prime or not.

3 Answers   TCS,


Is python written in c or c++?

0 Answers  


Definition of class?

12 Answers  






How to construct muliton object

2 Answers   Symphony, TCS,


Is c# written in c++?

0 Answers  


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

0 Answers  


What is a static element?

0 Answers  


Badboy is defined who has ALL the following properties: 1. Does not have a girlfriend and is not married. 2. He is not more than 23 years old. 3. The middle name should be "Singh" 4. The last name should have more than 4 characters. 5. The character 'a' should appear in the last name at least two times. 6. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers

1 Answers  


How can you force instantiation of a template?

1 Answers   ABC, Amazon,


Explain the term memory alignment?

0 Answers  


Categories