public abstract class PureAbstract
{
public abstract bool GetData();
}
public class ChildClass : PureAbstract
{
public override bool GetData()
{
Console.WriteLine("Pure Abstract Class called");
Console.ReadKey();
return true;
}
}
public class DIClass
{
private PureAbstract pureAbstract;
public DIClass(PureAbstract abstractClass)
{
this.pureAbstract = abstractClass;
this.pureAbstract.GetData();
}
}
class Program
{
static void Main(string[] args)
{
ChildClass child = new ChildClass();
DIClass pureAbstract = new DIClass(child);
}
}
We all know that Interface allows us Multiple Inheritance in C#, but I want to know that if we ignore this reason and assume we always need single inheritance in our application then what is difference between Pure Abstract Class and Interface.