- Expert C++
- Vardan Grigoryan Shunguang Wu
- 133字
- 2021-06-24 16:34:00
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.
推薦閱讀
- Learning NServiceBus(Second Edition)
- Beginning C++ Game Programming
- Raspberry Pi 2 Server Essentials
- CKA/CKAD應試教程:從Docker到Kubernetes完全攻略
- The DevOps 2.4 Toolkit
- 精通Python設計模式(第2版)
- SharePoint Development with the SharePoint Framework
- 微信小程序入門指南
- NoSQL數據庫原理
- IDA Pro權威指南(第2版)
- IBM Cognos TM1 Developer's Certification guide
- Mastering Concurrency Programming with Java 9(Second Edition)
- 交互式程序設計(第2版)
- R語言數據挖掘:實用項目解析
- JavaScript Unit Testing