C # encapsulation, inheritance, and polymorphism,

Source: Internet
Author: User

C # encapsulation, inheritance, and polymorphism,

Encapsulation

Encapsulates the attributes and implementation details of classes and objects, and only exposes interfaces to control the read and modify access levels of attributes in the program. Class provides three optional access levels: public, protected, and private. By setting different data access levels and customizing data access permissions, You can ensure the unification of data and shared data.

Inheritance

Class Inheritance refers to adding new data and behaviors on the basis of the original class to form a new class. Class inheritance improves code reusability and reduces the burden on developers.

Polymorphism

Polymorphism is based on inheritance. In addition to adding data and methods on the basis of the base class, the methods in the base class can be redefined to make the method more targeted.

Related Article

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.