Inheritance and interfaces

Source: Internet
Author: User

Inheritance and interfaces
Overview: understand the differences between class inheritance and interface implementation in Microsoft Visual Basic. NET.
Target
Concepts behind inheritance and interface use
When to use class inheritance and interface implementation
Requirements
To make full use of this article, readers must have the following foundations:
 Familiar with Microsoft®Visual Basic®. NET Language
Familiar with Microsoft Visual Basic 6.0
Glossary
Directory
Object-Oriented Programming: Why programming?
Inheritance level
Create and implement interfaces
Comparison class inheritance and interface implementation
Object Merging
What is the difference with Visual Basic 6.0?
Summary
Object-Oriented Programming: Why?
Only a small number of Visual Basic 6.0 programmers found that they needed to create class modules when building Visual Basic 6.0 forms, rather than using automatically created forms. In addition, most programmers who have created class modules in Visual Basic 6.0 only create ActiveX®And you have to use the class module.
In Visual Basic. NET, as in all other languages, Object-Oriented Programming (OOP) is not a choice but a requirement. Each piece of code is a type, such as a class, interface, structure (the structure is a value type, similar to the User-Defined type in Visual Basic 6.0), or part of the enumerated value. Even the seemingly independent process in Visual Basic. NET is actually implemented as a shared method for hiding classes.
Why is OOP so powerful? Why does Microsoft always ask everyone to learn how to program with OOP in Visual Basic. NET?
Handling complexity and changes
OOP solves two common software development problems: Dealing with complexity and handling changes. Using OOP makes it easy to design and use complex software systems and to modify these systems without disrupting them.
Visual Basic 6.0 programmers need to use the ADO or DAO object model to obtain and operate data. Imagine that if each operation must call an independent function, instead of using an object (such as a record set) method or attribute, how difficult it will be to complete such a job. For example, if you want to use ADO or DAO to load data into the list box, you need to write about 10 lines of code. Using odbc api functions directly requires about 50 lines of code! We can see that the OOP method is easier to implement.
For example, consider Microsoft Windows®API. If it takes a lot of time to call Windows®When using APIs or other process-oriented APIs, you can find out how error-prone and difficult to remember which function or process is called for a task. Therefore, it is more friendly for programmers to create related objects and model problems than to use a long column process or function.
Writing and debugging code is difficult, but most programmers like to track problems and design a flexible solution, and then play with the code until everything meets the customer's needs. This is part of an interesting person, but it is not the end of the story. One thing programmers are afraid of is that they have to study the code written by others (or the code they wrote when they started writing code long ago ), you have to design and how each part of the program works together, and how to make changes to meet new requirements-all of which must not cause unexpected consequences. Unfortunately, in most system lifecycles, maintaining code consumes more time than creating the Code. This is the end of these systems.

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.