3.7.4 inheritance

Source: Internet
Author: User

Inheritance extends a new class based on an existing class. The new class inherits the members of the existing class and can add new members. An existing class is called a parent class or a base class, and a new class is called a subclass or a derived class. In VB. NET, one class can only have one parent class. Multiple parent classes are not allowed, that is, only single inheritance is allowed.
Syntax:
Class Name
Inherits base class name
Class member declaration
End Class
The preceding syntax declares a new class derived from the class indicated by the base class name. The "class member declaration" is a newly added member of the derived class, which can be an attribute or method. For example:
Class Manager
Inherits Employee
Public Sub PrintBonus ()
Reponse. Write (yearlyBonus)
End Sub
End Class
The previous example defines the sub-class Manager of the Employee class. In addition to inheriting all the members of its parent class, this class also adds a method member PrintBonus ().
ASP. NET server controls are constructed according to the class hierarchy method. All Server Control classes are derived from System. web. UI. control class, so all server controls have System. web. UI. control class attributes, methods, and events, and each server Control class adds its own attributes, methods, or events. For more information about server controls, see Chapter 4th.

BibliographyPrevious sectionNext section

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.