Object: Consists of a behavior, a state, and a unique flag.
An abstract
Abstraction is to ignore aspects of a topic that are not relevant to the current goal, and to convert real-world concepts into objects, either a Vo object or an abstract class representing data, or an interface that represents a class of behavior. It is advantageous to draw out the unchanging things from the many changing states. It is advantageous to use inheritance to construct the system of class, implement polymorphism, use template and factory pattern method to realize the abstraction of business process. Abstraction is an important tool for conceptual modeling and business process modeling and is the cornerstone of an object-oriented architecture, not a cluttered, chaotic, repetitive, sand-like, complex class.
Two inheritance
is a hierarchical model of a Nexus class, and allows and encourages the reuse of classes, providing a way to express commonalities.
Inheritance means being able to declare a type and inherit all the operations and data from the parent class, and colleagues have the opportunity to declare their new methods to improve, materialize, replace, or extend the methods in the parent class
Use the parent class to establish hierarchical models for the application domain, provide code reuse, and allow customization.
Prevent inheritance: Using the Final Declaration class or method, meaning cannot be modified, when a class is declared final, only the method is automatically set to final, and the field does not. Final has two advantages: 1, Security 2 efficient
Type conversion: 1, must be carried out within the inheritance system
2, before conversion, should first use instanceof for inspection.
Super: Not a reference to an object, but a special keyword that points to the compiler calling the superclass:
1, call the Superclass Method 2, call the superclass constructor.
Three, polymorphic
An object variable can point to a variety of actual types of phenomena.
Dynamic binding: A phenomenon in which an object automatically chooses the correct method for invocation at run time
Process:
1. Compiler checks the object's declaration type and method (virtual machines pre-computes a method table for each class)
2. Overload resolution: The compiler checks the method parameter type provided in the method call (method prototype: First name and argument list, return value is not part of the prototype)
3, static binding: If the method is private,static,final, or is a constructor
4. Dynamic binding: The virtual machine must invoke the actual type of object to which the object variable points and the matching method version.
Four, Package
The implementation process of combining data and behavior in a package, and hiding data about the object's consumer, encapsulates the object's "black box" feature.
Four features of object-oriented Java learning