Everywhere I see, there are blogs, content, notes that say Abstract classes cannot be instantiated.
Now in c# I created a sample code, something like this:
public abstract class Fundamental
{
public Fundamental()
{
Console.WriteLine("This is an abstract constructor");
}
}
Now why does the comipler suggest that the constructor must be protected. Why does it even allow a constructor.
I know what we can do a class instantiation like this,
Fundamental instance = new LessFundamental();
where less fundamental is this:
public class LessFundamental : Fundamental { }
But why the constructor. Also I can use internal, protected, public on this abstract class constructor. At some places it is mentioned that
You can still extend the abstract class and call the abstracts class' constructor in your derived class
But when would one need it?
Which design scenario does it cater to