On the succession conclusion of C #

Source: Internet
Author: User

1. Inheritance: Inheritance is a class that can use properties and methods (members) of another class

2. Subclass inherits the symbol used by the parent class as ":" (colon)

3. Subclasses can inherit private members of the parent class, but cannot be accessed (cannot be used)

4. Construction of parent class, subclass cannot be inherited

5. When the subclass construct is called, the base keyword is not used, and the system adds the base () by default and enters the construction of the parent class.

6. Subclasses can use base in the constructor method. The parent class property or the parent class method or this. Parent class property or method, but cannot use base. Subclass property or method, use this only

7. In the subclass of the parameter structure can use the base (parameter 1, Parameter 2) method of the parameter, and the order of the parameters of the base is based on the parent class with parameters constructed parameter order, and the parameter variable name in base is based on the sub-class parameters of the variable name consistent

8. Two major features of inheritance: A: Single: A class can have only one parent class B: transitive: If A is the parent of B and B is the parent of C, then C can also call A's properties and methods

9.new sub-class underlying principle:

1. Go to the subclass construct, but do not enter the structure

2. Turn to the parent class and enter the parent constructor to execute

3. Turn back to subclass constructs, execute subclass constructs

4. Go to Main, build a subclass in memory

On the succession conclusion of C #

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.