Object-Oriented Overview:
Elephant to the refrigerator for example. When we talk about object-oriented, we must talk about the process.
Process oriented: Open the refrigerator, load the elephant, and close the refrigerator. These three steps are the process-oriented way of thinking, which emphasizes the process and can also be called action. That's the way it is in C.
Object-oriented: refrigerator open, refrigerator storage, refrigerator off. This is the object-oriented way of thinking, which emphasizes the object, or can be said to be an example. Used in java,c++,c#.
Object-oriented features
1. Object-oriented thought conforms to people's habitual thinking way.
2, the appearance of object-oriented, to simplify the problem
3. Object-oriented will be the executor of the process, become the object of the conductor.
Class and object relationships:
Simply put:
Class: The description of things, the description of things usually have attributes and behavior two aspects, as long as they are clear and defined in a class can be
Object: an instance of such a thing, which is the entity of the real existence of such things.
Objects are created by using the keyword new.
use conditions for anonymous objects :
Condition One: When an object method is called only once, it can be done with an anonymous object, which makes it easier.
Condition Two: An anonymous object can be passed as an actual parameter.
How the object is called in memory:
Creating an object from new creates an object in heap memory that contains an address pointer and a default value initialized by the constructor. The stack memory is called by the object pointing to the address pointer of the heap memory.
The difference between a member variable and a local variable in a class:
1.
Member variables are defined in the class, and the entire class can be accessed.
Local variables are defined in functions, statements, and local code blocks, and are only valid for access in the area to which they belong.
2.
The member variable exists in the heap memory object.
Local variables exist in the stack memory method.
3.
The member variable exists as the object is created and disappears as the object disappears.
Local variables exist with the execution of the owning region and are released as the end of the owning region.
4.
Member variables have default initialization values.
Local variables do not have default initialization values.
Characteristics of Class-type variables:
The class type variable must point to the object, otherwise it is null.
The above is a simple introduction to object-oriented content, the next one is the three major characteristics of object-oriented
Object-oriented summary of Java Basic Learning notes