Object-oriented programming (OOP)
Describe the problem according to the problem, rather than the computer that runs the solution. Each object has a state, an action, and the user can ask the object to perform these actions. Object-oriented five basic features:
1. All things are objects;
2. A program is a collection of objects that tell each other what to do by sending messages;
3. Each object has its own storage consisting of other objects, that is, you can create new types of objects by creating packages that contain existing objects. (privately considered as an inheritance mechanism);
4. Each object has its own type;
5. All objects of a particular type can receive the same message. Classes and Objects
Each object belongs to a particular class that defines the attributes and behavior.
A class is actually a data type, for example, all floating-point numbers have the same set of attributes and behaviors.
Object O=newobject ();
The object is created in this way by defining a reference (O) for the object, and then calling the new method to create a fresh object of that type.
Imagine an object as a "service provider": The program itself will provide services to the user, and it will do so by invoking the services provided by other objects. Seeing an object as a service provider helps improve the cohesion of the object. Each object should be able to perform some tasks well, but not try to do more.