-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbstractClass.cs
48 lines (37 loc) · 1.09 KB
/
AbstractClass.cs
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
using System;
namespace TestApplication
{
/* Abstract class can contain abstract method and non abstract method*/
public abstract class AbsClass
{
protected static int AddTwoNumber(int a, int b)
{
return a + b;
}
public abstract int MultiplyTwoNumber(int a, int b);
public abstract void AbstractMethod();
public void NonAbstractMethod()
{
Console.WriteLine("Non Abstract Method");
}
}
public class AbsDerived : AbsClass
{
public static void Main()
{
var calculate = new AbsDerived();
var added = AddTwoNumber(25, 45);
var multiply = calculate.MultiplyTwoNumber(12, 10);
Console.WriteLine("Added value is {0}", added);
Console.WriteLine("Multiply value is {0}", multiply);
}
public override int MultiplyTwoNumber(int a, int b)
{
return a * b;
}
public override void AbstractMethod()
{
Console.WriteLine("this is abstract value");
}
}
}