- 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.
推薦閱讀
- JSP網絡編程(學習筆記)
- Selenium Design Patterns and Best Practices
- C語言程序設計
- PhpStorm Cookbook
- Hands-On Reinforcement Learning with Python
- Learning Continuous Integration with TeamCity
- Flowable流程引擎實戰
- Rust游戲開發實戰
- Python編程:從入門到實踐(第3版)
- 動手打造深度學習框架
- Practical Microservices
- Fastdata Processing with Spark
- jQuery技術內幕:深入解析jQuery架構設計與實現原理
- 算法圖解
- Photoshop智能手機APP界面設計