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

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. 

主站蜘蛛池模板: 子洲县| 江阴市| 罗甸县| 沁阳市| 孝昌县| 张家港市| 梧州市| 黄山市| 阿勒泰市| 清镇市| 淮滨县| 龙里县| 随州市| 密云县| 伊川县| 育儿| 恩平市| 时尚| 临猗县| 桦川县| 盖州市| 讷河市| 和林格尔县| 台江县| 河西区| 黄山市| 昌乐县| 林甸县| 南郑县| 禹城市| 社旗县| 赣榆县| 阜康市| 宜丰县| 满城县| 五莲县| 习水县| 格尔木市| 沛县| 乌拉特中旗| 鄢陵县|