Multi-level Inheritance

Inheritance can have multiple levels. That is, a base class can have derived classes, each of which can have derived classes, and so on. These classes constitute what is known as an inheritance hierarchy (or inheritance tree). All the rules that apply for single-level inheritance also apply for multiple level inheritance. You can extend your example with the Person, Employee, and Customer to add two more classes to the hierarchy: SalesEmployee and Manager. These are both derived from the Employee class. The sales employees have a base salary (represented by the base class Employee m_salary) and a monthly bonus, calculated based on a percentage of the salary. The managers have a salary (like all employees) and a managerial ...

Get Visual Basic® .NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.