-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (20 loc) · 766 Bytes
/
Copy pathProgram.cs
File metadata and controls
27 lines (20 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\n* Results from BaseClass:\n");
BaseClass baseClass = new BaseClass();
baseClass.SayHello();
Console.WriteLine("\n* Results from DerivedClass:\n");
DerivedClass derivedClass = new DerivedClass();
derivedClass.SayHello();
derivedClass.SayBye();
Console.WriteLine("\n* Results from DerivedClass stored as a BaseClass variable:\n");
BaseClass derivedClassAsBaseClass = new DerivedClass();
derivedClassAsBaseClass.SayHello();
// Cannot call this as we only have the interface of a BaseClass
// derivedClassAsBaseClass.SayBye();
Console.ReadKey();
}
}