1, talk about your understanding of object-oriented?

Object-oriented three properties: encapsulation, inheritance, polymorphism; Object-oriented characteristics of the four: encapsulation, inheritance, polymorphism, abstract

1) Inheritance: Inheritance is the process of creating a new class of information to be inherited from an existing class. Provide information inherited class is called the parent class (superclass, base class); obtained following the
Category for the information is called a subclass (derived class). Inheritance allows a software system changes in a certain continuity, while also inherit variables in the program packages
Important means.
 
2) Package: encapsulation is generally considered a method of operating data and bind data, access to the data only via the defined interfaces. Object-Oriented
The essence is to depict the real world into a series of completely autonomous, closed objects. The way we write in the class is an encapsulation of implementation details; I
You write a class that encapsulates data and data manipulation. We can say that the package is to hide all hide things, to provide the most simple programming only to the outside world
interface.
 
3) Polymorphism: polymorphism refers to allow objects of different sub-types respond differently to the same message. Simply put, it is to use the same object reference tone
The same way but do different things. Polymorphism Polymorphism Polymorphism is divided into compile-time and run when. If the method of the object as an object out
Services sector provided, then the run-time polymorphism can be interpreted as: When A system to access services provided by the system B, B system has a variety of ways to provide services,
But everything is transparent to A systems. Method overloading (overload) is implemented compile-time polymorphism (also called pre-binding), and method overrides
(Override) to achieve polymorphism (also called a binding post) runtime. Run-time polymorphism is the essence of an object-oriented best thing to do to achieve polymorphism
Two things: a method override (parent class and subclass inherits existing abstract parent class or overridden); second object shape (with reference subtype supertype reference pair.
Like, this reference the same method call will exhibit the same behavior different according to different subclasses of objects).
 
4) Abstract: Abstract is to sum up the common features of a process of constructing a class object class, data abstraction and include both behavioral abstraction. Abstract only focus on
Like what attributes and behavior, not concerned about the details of what these behaviors yes.
 
发布了72 篇原创文章 · 获赞 134 · 访问量 11万+

Guess you like

Origin blog.csdn.net/Point9/article/details/104071572