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



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

Answer / atul shankhwar

 The condition should hold at the end of every constructor.

 The condition should hold at the end of every mutator(non-const) operation.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What is the error in the sample code above? a) The class X does not have any protected members. b) The static member function f() accesses the non-static z. c) The static member function f() accesses the non-static x. d) The member function f() must return a value. e) The class X does not have any private members.

2 Answers   Quark,


What are register variables?

0 Answers  


Define stacks. Provide an example where they are useful.

0 Answers  


What is the difference between a baller and a reference in C++?

0 Answers  


What you mean by early binding and late binding? How it is related to dynamic binding?

1 Answers  






Can malloc be used in c++?

0 Answers  


State the difference between delete and delete[].

0 Answers  


What is namespace & why it is used in c++?

0 Answers  


whats the size of class EXP on 32 bit processor? class EXP { char c1; char c2; int i1; int i2; char *ptr; static int mem; };

5 Answers   Huawei,


What is c++ code?

0 Answers  


What are namespaces in c++?

0 Answers  


Can we specify variable field width in a scanf() format string? If possible how?

0 Answers  


Categories