Structure and class
Structure: aggregate, which is a derived data type
Array/structure/enumeration/Union:
Similarities:
All-aggregates
Not required:
1. the array contains elements of the same data type. Each element has a number mark under the array.
2. Variables of different data types can be included.
3. The Enum keyword is used to declare enumeration. It is generally used to declare a regular Object Body of an element.
4. Using the keyword union to declare union, the address of each member of the Union is the address of the Union object. The reason why they share an address is that the Union is also called a community. Therefore, only the value assigned to the union member is valid.
Object: objects are called objective objects in the real world. As long as they are objective objects, you can get abstract objects.
You can use the object name, attribute, and method to describe the object.
Like constructing enumeration and structure, a class is also a data type constructed by the user.
Create a new object type based on the existing object type. It inherits the features and functions of the original object. This idea is the main contribution of object-oriented design.
The process of generating a class from one or more previously defined classes is called derivation. This new class is also a derived class.
Inheritance refers to the features that the new class obtains from the base class, that is, the data functions that inherit the base class.
We can see that:
A class has better functions than a structure and has many properties. A class contains functions and can be viewed as a living creature. It can perform a series of actions or even inherit from it;
The structure seems to be a "Notebook", which only records some properties of objects.