- Expert C++
- Vardan Grigoryan Shunguang Wu
- 158字
- 2021-06-24 16:34:00
Understanding objects
Most of the time, we operate with a collection of data grouped under a certain name, thus making an abstraction. Variables such as is_military, speed, and seats don't make much sense if they're perceived separately. Grouping them under the name with spaceship changes the way we perceive the data stored in the variables. We now refer to the many variables packed as one single object. To do so, we use abstraction; that is, we collect the individual properties of a real-world object from the perspective of the observer. An abstraction is a key tool in the programmer's toolchain as it allows them to deal with complexity. The C language introduced the struct as a way to aggregate data, as shown in the following code:
struct spaceship {
bool is_military;
int speed;
int seats;
};
Grouping data is somewhat necessary for object-oriented programming. Each group of data is referred to as an object.
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- JavaScript修煉之道
- Maven Build Customization
- Ext JS Data-driven Application Design
- Rust Cookbook
- Java Web應用開發技術與案例教程(第2版)
- Unity Shader入門精要
- Java應用開發技術實例教程
- 利用Python進行數據分析(原書第3版)
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- C語言從入門到精通
- OpenCV 3 Blueprints
- Android系統下Java編程詳解
- Visual Basic語言程序設計基礎(第3版)
- Java EE 7 Development with WildFly