Daily one question: What are the characteristics of object-oriented?

Question: What are the characteristics of object-oriented?

A: encapsulation, inheritance, polymorphism, and abstract.

1. The package encapsulates the object provides the ability to hide the internal characteristics and behavior. Object provides a number of methods that can be accessed by other objects to change the data within it. In Java, among them, three kinds of modifiers: public, private and protected. Each modifier to the other in the same package or in different packages below target given different access rights.

Here are some of the benefits of using the package:

  • By hiding the object's properties to protect the internal state of an object

  • Improved usability and maintainability of the code, because the behavior of the object can be changed or extended single

  • Prohibit adverse interaction between objects, increase the modularity

2. A successor to inherit field provides the ability to obtain and methods from the base class to the subject. Inheritance provides a line of code reuse, you can also add new categories to the existing characteristics without modifying the class.

3. Polymorphism Polymorphism is the underlying programming language to different data types do show the ability of the same interface. Operation on a polymorphic type may be applied to other types of the above values.

4. Abstract abstraction step is separated from the idea of a specific example, therefore, according to their function, rather than to create the class implementation details. Java supports the creation of exposure only and does not include an interface method implementation of the abstract class. The main purpose of this technology is the abstract class actions and implementation details separated.

Guess you like

Origin www.cnblogs.com/tong-yuan/p/11986518.html