top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Explain class invariant?

+1 vote
376 views
Explain class invariant?
posted Mar 18, 2015 by Jalal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Class Invariant:

-It is a condition that ensures correct working of a class and defines all the valid states for an object.

  • When an object is created class invariants must hold.

  • It is necessary for them to be preserved under all operations of the class.

  • All class invariants are both preconditions as well as post-conditions for all operations or member functions of the class.

answer Mar 19, 2015 by Mohammed Hussain
...