3 ms·
In this case you won't have default parameters at all when calling through a base class pointer, resulting in an error if you don't mention the parameter explic
by GuB-42 3y ago
In this case you won't have default parameters at all when calling through a base class pointer, resulting in an error if you don't mention the parameter explicitly.
It won't solve the problem, but it is a much saner behavior.
If you want the expected behavior, that is that a call through a base class pointer uses the default parameters of the derived class, then you shouldn't use default parameters at all. Use overloading instead.
- twic 3y agoOr make the default some sort of sentinel, and resolve it to a real default in the method.