Inheritance of classes (inheritance)

Source: Internet
Author: User

VB.net supports the inheritance of classes, allowing the user to define a class that, as a basis for inheriting from other classes, can inherit and extend the properties and methods of the base class, and the inheriting class can overload some methods of the base class, and all the default properties of the class that are established in vb.net are inheritable. Because the form is now considered a class, the user can inherit a new form from an existing form in vb.net.
One of the purposes of inheritance is to make code reusable. There are two ways to improve code reuse, compositing (composition), and Inheritance (inheritance), which has always been supported by Visual Basic to achieve code reuse, where users can build and reuse COM components, Inheritance is a new feature of vb.net, so that users can create a new class as the base class for other classes.
Both inheritance and interface (Interface) allow polymorphism, meaning that two or more classes can be defined, and each class defines a method or property with the same name, and when the method or property is run on the client, the methods and properties of the different classes can be selected depending on the special case. Polymorphism is necessary in object-oriented programming because it allows users to invoke properties or methods using the same name, regardless of when the object is in use.

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.