We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b702e6e commit e7431b6Copy full SHA for e7431b6
1 file changed
MethodOverriding.cs
@@ -0,0 +1,44 @@
1
+using System;
2
+using System.Diagnostics;
3
+
4
+namespace TestApplication
5
+{
6
7
+ /* Polymorphism --- Example of Method Overriding ---
8
9
+ When derived class has a definition for one of the member functions of
10
+ the base class. that base function is said to be overriden.
11
12
13
14
+ */
15
16
+ public class Vehicle
17
+ {
18
+ public virtual void show()
19
20
+ Console.WriteLine("Base Class");
21
+ }
22
23
24
+ public class Honda : Vehicle
25
26
+ public override void show()
27
28
+ Console.WriteLine("Derived Class");
29
30
31
32
+ internal static class Polymorphism
33
34
+ public static void Main(string[] args)
35
36
+ var vehicle = new Vehicle();
37
+ vehicle.show();
38
39
+ vehicle = new Honda();
40
41
42
43
44
+}
0 commit comments