I came across this statement in the Framework Design Guidelines, page 84:
“DO NOT define public or protected-internal constructors in abstract types.”
Then it reads:
“DO define a protected or an internal constructor on abstract types.”
Sure. Makes perfect sense. Then come the examples. It says the following code is good design:
So far so good. Everything I’ve shown and read so far is something I think we’ve all known and agreed with for many, many years. Its basic abstract class design.
This next bit of code is labeled as good design/incorrect design:
Why would this be bad design, as the book states? Simple constructors are fine. Protected constructors for abstract classes are fine. So whats the deal?
At first the thought was, maybe its creating a default public parameterless constructor that gets exposed. But, the compiler is smarter than that and its not. So far the only thing I can figure out is that design guidelines require that a parameterless, protected constuctor always exist for an abstract type.
What are your thoughts on this? Why would the above abstract class MyFirstAbstract be bad design?