Class invariant
Encyclopedia : C : CL : CLA : Class invariant
- This article is about class invariants in computer programming, for use of the term in mathematics, see equivalence class and invariant.
Class invariants are established during construction and constantly maintained between calls to public methods. Temporary breaking of class invariance between private method calls is possible, although not encouraged.
Example
This is an example of a class invariant in D. The invariant must hold to be true after the constructor is finished, before the destructor gets called, and at the entry and exit of all public member functions.
class Datethis(int d, int h) }
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
