R4R
Right Place For Right Person TM
 

R4R C# C# Examples Abstract class in C#

C# Examples             

Index 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

Example of Abstract class in C#

         



/*Abstract class 
	class :- 1)Concreet class(We can create object  of that)
	**method:- concreet method(method having body)
	       2)Abstract class(we can not create object, 
because it is too general )
	**method :-1) abstract method(method without body)
		 2) concrete method
	it is used to inherit
		
*/
abstract class human
{
	//Abstract methods
	public  abstract void hair();
	//Concrete method
	public void display()
	{
		System.Console.WriteLine("hello");
	}
	
	
}
class boys : human
{
	public override void hair()
	{
		System.Console.WriteLine("Small");
	}
	
}
class girls : human
{
	public override void hair()
	{
		System.Console.WriteLine("LONG");
	}

}
class  a
{
	public static void Main()
	{
		boys b=new boys();
		girls g=new girls();
		b.hair();
		g.hair();
		b.display();
		g.display();
		
		
		
	}
}

 Download Source Code

Index 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

New Updates

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R