What is an abstract class?
What is an abstract class?
It is defined by keyword abstract. It has no implementation, only has the definition of the method without body.
All the methods and properties in an Interface by default public and abstract.
we can use static in Interface
ex:
Definition of Abstract
public abstract class product
{
protected string ID;
protected double ID;
public abstract string ID
{
get;
set;
}
public abstract double price
{
get;
set;
}
public abstract double calculation();
}
Implement of Abstract
public class Implement:Product
{
public override string ID
{
get
{
return id;
}
set
{
id=value;
}
}
public override double Price
{
get
{
return price;
}
set
{
price=value;
}
}
public override double calculation()
{
return Price*1.25;
}
}
Testing of Interface
Implement TestI=new Implement();
TestI.Id="B1";
TestI.Price=900.00;
double Iamt=TestI.calculation();
There are currently 1 users browsing this thread. (0 members and 1 guests)