Say not you know another entirely, till you have divided an inheritance with him. Johann Kasper Lavater
Say not you know another entirely, till you have divided an inheritance with him.
Johann Kasper Lavater
This method is to define as the number of a class the class of all classes similar to the given class. Bertrand Russell
This method is to define as the number of a class the class of all classes similar to the given class.
Bertrand Russell
Good as it is to inherit a library, it is better to collect one. Augustine Birrell
Good as it is to inherit a library, it is better to collect one.
Augustine Birrell
Save base authority from others' books. William Shakespeare
Save base authority from others' books.
William Shakespeare
In this chapter you will learn:
What inheritance is and how it promotes software reusability.
The notions of base classes and derived classes.
To use keyword Inherits to create a class that inherits attributes and behaviors from another class.
To use the access modifier Protected in a base class to give derived class methods access to base class members.
To access base class members from a derived class with MyBase.
How constructors are used in inheritance hierarchies.
To access the current object with Me and MyClass.
The methods of class Objectthe direct or indirect base class of all classes in Visual Basic.
Outline
10.1 Introduction10.2 Base Classes and Derived Classes10.3 Protected Members10.4 Relationship between Base Classes and Derived Classes10.4.1 Creating and Using a CommissionEmployee Class10.4.2 Creating a BasePlusCommissionEmployee Class without Using Inheritance10.4.3 Creating a CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy10.4.4 CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using Protected Instance Variables10.4.5 CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using Private Instance Variables10.5 Constructors in Derived Classes10.6 Software Engineering with Inheritance10.7 Class Object10.8 Friend Members10.9 Wrap-Up
10.1 Introduction
10.2 Base Classes and Derived Classes
10.3 Protected Members
10.4 Relationship between Base Classes and Derived Classes
10.4.1 Creating and Using a CommissionEmployee Class10.4.2 Creating a BasePlusCommissionEmployee Class without Using Inheritance10.4.3 Creating a CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy10.4.4 CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using Protected Instance Variables10.4.5 CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using Private Instance Variables
10.4.1 Creating and Using a CommissionEmployee Class
10.4.2 Creating a BasePlusCommissionEmployee Class without Using Inheritance
10.4.3 Creating a CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy
10.4.4 CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using Protected Instance Variables
10.4.5 CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using Private Instance Variables
10.5 Constructors in Derived Classes
10.6 Software Engineering with Inheritance
10.7 Class Object
10.8 Friend Members
10.9 Wrap-Up