This question is out of curiosity. Is there a difference between:
public abstract class MyClass
{
public MyClass()
{
}
}
and
public abstract class MyClass
{
protected MyClass()
{
}
}
Thanks.
This question is out of curiosity. Is there a difference between:
public abstract class MyClass
{
public MyClass()
{
}
}
and
public abstract class MyClass
{
protected MyClass()
{
}
}
Thanks.
In terms of future use of this code, there is no difference.
You shouldn't have a public constructor in an Abstract class Constructors on abstract types can only be called by derived types. Because public constructors create instances of a type, and you cannot create instances of an abstract type, an abstract type with a public constructor is incorrectly designed.
have a look here for details http://msdn.microsoft.com/en-us/library/ms182126.aspx
They are the same for all practical purposes.
But since you asked for differences, one difference I can think of is if you are searching for the class's constructor using reflection, then the BindingFlags that match will be different.
This will find the constructor in one case, but not the other.