Object-Oriented Programming Language object-oriented Implementation Mechanism

Source: Internet
Author: User
ArticleDirectory
  • Encapsulation-hide internal implementation
  • Inheritance-reuse object attributes and Behaviors
  • Polymorphism-extends subclass Behavior

Object-oriented is of great significance, not just the use of object-oriented in programming.Programming Language(Oopl) implements object-oriented. Because everyone isProgramTo a large extent, it is considered that object-oriented programming is object-oriented. The misunderstanding here should be a misunderstanding that everyone may make when I first study programming. In fact, object-oriented is an idea. We need to use this idea throughout the entire process of software development to guide the process of analysis, design, and implementation.

 

There are three mechanisms to implement object-oriented programming languages. This article mainly explains why these implementation mechanisms are available in object-oriented programming languages, not just how these mechanisms are implemented in programming languages.

Encapsulation-hide internal implementation

After an object is instantiated, some changes may occur inside the object instance during the running process of the object instance, or the status of the object instance is changed externally, then, the caller of the object instance needs a mechanism to obtain the status of the object instance, and finally outputs the status to the customer.

Object instances use a large numberCodeDetermine the object type and object status, and then determine how to give the customer a response. The caller of the object instance needs to know the internal structure of the object instance. This mechanism is not in line with the real world, because we do not know the internal structure of another thing. For example, we don't know how the TV works. So what kind of mechanism should be determined to call the object instance to obtain the object's behavior? Generally, it is based on the Interface call contract (not the interface of the programming language ). The encapsulation method in oopl is used to hide the internal implementation.

 

 

Inheritance-reuse object attributes and Behaviors

 

Polymorphism-extends subclass Behavior

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.