Answer the question
In order to leave comments, you need to log in
Why is it a bad idea to use the crutch protected constructorName() {} inside the class in order to inherit this class from another?
Suppose the described class from which we want to inherit has only constructors with parameters (there is no point in using constructs without parameters)
But this approach may seem wrong to many, so how to make it possible not to cut such crutches? To make the code below look more adequate and everything compiles
Class A {
protected A () {
}
public A (int _param) {
}
}
class B : A
{
}
Answer the question
In order to leave comments, you need to log in
If a constructor without parameters doesn't make sense, then don't create it. In this case, the inheriting class will be required to take care of the arguments. And that's okay.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question