C # Inheritance Detailed

Source: Internet
Author: User
Tags abstract inheritance

In order to improve the reusability and scalability of software modules, so as to improve the development efficiency of software, we always hope to make use of our predecessors ' or own previous development results, while we hope to have enough flexibility in our development process and not rigidly adhere to the reusable modules. Today, any object-oriented programming language must provide two important features: Inheritance (inheritance) and polymorphism (polymorphism).

If all classes are at the same level, this flat structure without relationships limits the object-oriented nature of the system. The introduction of inheritance is to establish an intersection between classes, so that instances of newly defined derived classes can inherit the characteristics and capabilities of existing base classes, and can add new attributes or modify existing ones to establish a hierarchy of classes.

The same operation acts on different objects, can have different interpretations, produce different execution results, this is polymorphism. Polymorphism is implemented by deriving classes that overload the virtual function method in a base class.

14.1 C # 's inheritance mechanism

14.2 polymorphism

14.3 Abstraction and sealing

14.3.1 abstract class for C #

Abstract methods for 14.3.2 C #

14.3.3 Sealing Class

14.3.4 Sealing method

14.4 Some questions about attributes in inheritance

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.