The development of OOP programming in object-oriented programming 1, low maintenance workload for process reusability
2, object-oriented reusability High Maintenance easy
Concept 1, object objects A concrete thing is an instance of a class
2, class-class entities that share the same attributes and behavior collectively
Features: 1, encapsulation: The core idea of OOP
Encapsulating properties and behaviors, hiding details
Ensure internal data integrity
2, Inheritance: Subclasses automatically inherit properties and behaviors of all parent classes
Java is a single-inheritance of all classes of the parent class object
3, Polymorphic: Overloading of methods overriding subclasses overriding the method of the parent class
A variety of forms of the Manifest class
Class 1, attribute: Refers to member variable to make data type make variable name and method sibling
2, method (also called function) ① format return value type method name (parameter data type parameter name) {method body}
② can have no return value, using void to represent
③ can be used without parameters, denoted by ()
Variables defined in the ④ method are local variables
There are four manifestations of the ⑤ method, which are embodied in the same day work.
The first form has no return value and the parameter parameter is equivalent to the vector
The second form has a return value of no parameters
The third form has a return value with parameters
Fourth form no return value no parameter
⑥return returns a keyword with a return value
3, definition: Define class keyword is class name {class Body}
4, Construction Method: ① method Name and class name to be consistent
② no return value, no void is required
③ generally used to initialize the properties of an object
④ If there is no construction method, automatically creates a constructor that defaults to no parameters if there are
The method of constructing the parameter has to use the method of constructing without parameters.
Manually loading car () {}
⑤ permission modifier (access rights)
Public common unrestricted cross-package cross-class can be called
Private only the inside of the class can be accessed
Protected protected By default this can be accessed within this package. Point to the existing class itself
Class property methods can be decorated
2016/1/17 Note 1, object-oriented programming OOP 2, class