-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (21 loc) · 848 Bytes
/
Copy pathProgram.cs
File metadata and controls
28 lines (21 loc) · 848 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)
{
// Cannot create the abstract class BaseClass
Console.WriteLine("\n* Cannot create instance of the abstract class BaseClass!");
// 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();
}
}