- 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.
推薦閱讀
- Beginning Java Data Structures and Algorithms
- Visual Basic編程:從基礎(chǔ)到實(shí)踐(第2版)
- Xcode 7 Essentials(Second Edition)
- 編寫(xiě)高質(zhì)量代碼:改善C程序代碼的125個(gè)建議
- 云計(jì)算通俗講義(第3版)
- 深度學(xué)習(xí):算法入門(mén)與Keras編程實(shí)踐
- Mastering Ext JS
- JavaScript:Moving to ES2015
- 基于Struts、Hibernate、Spring架構(gòu)的Web應(yīng)用開(kāi)發(fā)
- Unity 2017 Mobile Game Development
- Visual Basic程序設(shè)計(jì)上機(jī)實(shí)驗(yàn)教程
- Access 2010數(shù)據(jù)庫(kù)應(yīng)用技術(shù)實(shí)驗(yàn)指導(dǎo)與習(xí)題選解(第2版)
- HTML+CSS+JavaScript網(wǎng)頁(yè)制作:從入門(mén)到精通(第4版)
- PowerDesigner 16 從入門(mén)到精通
- 算法秘籍