asked 192k views
2 votes
What is a class invariant?

asked
User Stasia
by
8.3k points

1 Answer

5 votes

Answer:

In computer programming, specifically object-oriented programming, a class invariant is an invariant used for constraining objects of a class. Methods of the class should preserve the invariant. The class invariant constrains the state stored in the object

answered
User Laylaylom
by
8.3k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.