Inheritance and Windows Forms
(Page 1 of 5 )
VB.net is now considered an object oriented language with the new core changes in the language carried by Microsoft in this new edition of Visual basic. The object oriented programming has proven itself to be very powerful, robust, and beautiful to work with. Well, enough theories and marketing stuff and let’s get to the real thing! In this article we will not be only talking about a class’s inheritance, but will also take advantage of the Windows form inheritance that was produced Visual Studio.NET. (Yes, the forms are classes and can be inherited.) Let’s get on with it!
Let’s say that we are developing software for a mobiles company. We have technicians, and we certainly have some managers. As a matter of fact, both the technicians and the managers are employees in this mobiles company. Employees have names, and Age (for simplicity). Managers do management activities, and Technicians do the technical activities. So if we want to put this into code, then we will have the following:
1) Employee Class: which have the most common things between the Managers and technicians, in our case, the name and age.
2) Manager Class: since the manager is in essence and Employee, then this class will inherit its basics from the Employee Class.
3) Technician Class: again, a Technician is an Employee, and this class should inherit its basics from the Employee Class.
So far, so good. Straight forward implementation, to be sure - but where is the beef?
Well, since out application is to work with the objects mentioned above, then yes, what you are thinking of is true; there should be some windows forms to help me interact with these objects. So we will be talking about a very basic form that will enable the users from adding new Manager, Technician, in other words and Employee.
Go ahead and download the project and open the solution to have a better understanding about what’s going on. As you can see, we have three classes in the “Classes” folder under the project, which contain (as expected) the Employee class, with a Name and an Age, and the other two classes that are inheriting from the Employee class: Manager and Technician.
Next: Exploring Forms >>
More Visual Basic.NET Articles
More By Mohammed Qattan