What are all the difference between an abstract class, and a class with only protected constructor(s)? They seem to be pretty similar to me, in that you can t instantiate either one.
EDIT:
How would you create an instance in a derived class, with a base class with a protected constructor? For instance:
public class ProtectedConstructor
{
protected ProtectedConstructor()
{
}
public static ProtectedConstructor GetInstance()
{
return new ProtectedConstructor(); // this is fine
}
}
public class DerivedClass : ProtectedConstructor
{
public void createInstance()
{
ProtectedConstructor p = new ProtectedConstructor(); // doesn t compile
}
public static ProtectedConstructor getInstance()
{
return new ProtectedConstructor(); // doesn t compile
}
}