-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHierarchical_Inheritance.cs
More file actions
62 lines (54 loc) · 918 Bytes
/
Hierarchical_Inheritance.cs
File metadata and controls
62 lines (54 loc) · 918 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
/* This is example of Hierarchical inheritance.
* in that there is One Base Class and Many derived class which extand from base class only ;
*
* Example -
* Class A
* Class B : A
* Class C : A
* Class D : A
*
*/
namespace ConsoleApp50
{
class A // this is base class
{
public string Cradit()
{
return "Balance is cradited";
}
}
class B : A // this is derived class
{
public string Debit()
{
var t = Cradit();
Console.WriteLine(t);
return "balance is debited";
}
}
class C : A
{
public string Test()
{
return "Hello Harshal Raverkar";
}
}
class D : A
{
public string Test1()
{
return "Hello Harshal Raverkar 123";
}
}
class Program
{
static void Main()
{
var t = new A();
t.Cradit();
var r = new D();
r.Test1();
}
}
}