Abstract Class
1)An abstract class is a special kind of class that cannot be instantiated
2)Abstract class can only inherit from one abstract class.
3)An abstract class can provide complete, default code and/or just the details that have to be overridden.
4)Fast
5)An abstract class can have fields and constrants defined
Interface
1)Interface is not a class. It is an entity that is defined by the word Interface.
2) An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body.
3) A class can implement more than one interface
4)If various implementations only share method signatures then it is better to use Interfaces.
5)An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public
6)No fields can be defined in interfaces
//Abstarct Class
public abstract class Vehicles
{
private int noOfWheel;
private string color;
public abstract string Engine
{
get;
set;
}
public abstract void Accelerator();
}
//Interface
public interface Vehicles
{
string Engine
{
get;
set;
}
void Accelerator();
}
Venu510, if this helps please login to Mark As Answer. | Alert Moderator