官术网_书友最值得收藏!

State

Each object has a state that may or may not differ from the state of other objects. We've already introduced the Product struct, which represents an abstraction of a physical (or digital) product. All the members of a product object collectively represent the state of the object. For example, the Product contains members such as available, which is a Boolean; it equals true if the product is in stock. The values of the member variables define the state of the object. If you assign new values to the object member, its state will change:

Product cpp_book; // declaring the object
...
// changing the state of the object cpp_book
cpp_book.available = true;
cpp_book.rating = 5;

The state of the object is the combination of all of its properties and values. 

主站蜘蛛池模板: 景泰县| 房产| 南通市| 迁安市| 河源市| 获嘉县| 沐川县| 武山县| 弥勒县| 六枝特区| 平顺县| 台安县| 七台河市| 梅州市| 湘潭县| 邵阳市| 岱山县| 承德市| 苗栗市| 横山县| 宁武县| 墨脱县| 郓城县| 杭锦后旗| 贺兰县| 来宾市| 进贤县| 陇西县| 湖南省| 留坝县| 海丰县| 廊坊市| 抚州市| 沧州市| 沭阳县| 海安县| 汶上县| 台东县| 怀仁县| 温州市| 玉山县|