1. The class is definable;
2. Subclass refers to a class derived from another class. The general term is inheritance (or class inheritance ).
A person is a class (not a "human", huh, huh). For example, if it is you, it first includes the characteristics (attributes and methods) that are public to the person class ), then it belongs to its own unique place.
3. Relationship between classes and objects:
A class is an abstract representation of an object. An object is an object created by a class.
For example, you are an object created by the human class.
For example, define a class... class as an animal... class instance and an object. For example, a dog or a dog is a specific object ..
------------
The most classic sentence: Everything is a object. Everything is a set of zero or multiple attributes of an object.
---------------------------------
Suppose all the countries in the world are a class, and China is an object. is China's area and population two attributes of this object?
The state class specifies the attributes and functional rights and obligations of the State. China is the default initialization of functional rights and obligations of an instantiated object in this class ..., china is used to execute a national right. in this way, China and other countries have different sizes, such as permanent members and one-vote veto power, this requires you to inherit a permanent member from the country class and write in the attributes and methods of this one-vote veto, then, the Chinese object will be generated from this permanent member category.
---------------------
For example, a bed has a length, width, and height, which is the attribute of the bed and can be used for sleeping. This is the bed function.
We abstract the bed into a class and abstract it into a bed class.
Class bed
{
Public:
Int length;
Int width;
Int height;
Void sleeping ();
};
We can't see the bed because we didn't define an object for your bed, that is, an object.
For example:
Definition:
Bed and child bed;
Then we can give:
Child bed. Length = 1.5 meters;
Child bed. width = 0.75 meters;
Child bed. Length = 0.5 meters;
We can make the children:
Children's bed. Sleeping ();
---------------
Important:
Class as the soul of Object-oriented has been widely used in C # language.
C # All classes directly or indirectly inherit from the system. Object Class
C # It does not have a class library. The class library used is the class library in the. NET Framework --. NET Framework SDK.
The. NET Framework SDK provides two namespaces for network programming: "system. Net" and "system. net. Sockets ".
C # implements network communication through the classes and Methods encapsulated in the two namespaces.
A control is actually one or more encapsulated classes. A reference control is a class call.
------------------------
Object-Oriented Programming: understanding of object attributes, methods, and events