
Chapter 3: Learning Just Enough C# and VB.NET: Types and Members | 71 |
Listing 3-4 Code using inheritance
C#:
Cashier cashr = new Cashier(); cashr.FirstName = "May";
VB:
Dim cashr As New Cashier cashr.FirstName = "May"
According to Listing
TIP
You can often use the phrase “is a” to describe the relationship between inherited classes when starting from the child class. For example, you can say “Cashier is an Employee.” If you apply this phrase technique to your software design and the sentence sounds logically correct, then you’ve probably used inheritance correctly.
The class Snippet
C# has a class snippet, but VB doesn’t. Before using the class snippet, create a new class file by