Abstraction is the representation of only essential features of an object and hiding unessential features of an object.It is a oop mechanism that hides irrelevant data and shows only relevant data.
Abstract class is a class that has abstract methods as well as other normal methods and properties.Abstract class cant be instantiated but it can be inherited.
You can define abstract methods(that does'nt have any implementation) in the base class and later we can write the imlementation of these abstract methods in the derived class.Here we are showing the relevant or essential data in the base class.
Example
Base class:-
public abstract class ParentClass
{
public abstract int Add(int a, int b);
public abstract int Subtract(int a, int b);
}
Derived class:-
public class ChildClass
{
public override int Add(int a,int b)
{
return a+b;
}
public override int Substract(int a,int b)
{
return a-b;
}
}
In the Main class Write..
ChildClass c=new ChildClass();
Response.Write("The Sum:"+c.Sum(5,5));
Respnse.Write("The Substract:"+c.Substract(10,5));
Packs, if this helps please login to Mark As Answer. | Alert Moderator