Item-37 Never redefine a function's inherited default parameter value
· โ 4 min read
Defaul parameter values are statically bound, while virtual function - the only functions we should be overriding - are dynamically bound.
Defaul parameter values are statically bound, while virtual function - the only functions we should be overriding - are dynamically bound.
Alternatives to virtual functions include the NVI idiom (as an example of the Template Method design pattern) and various forms of the Strategy design pattern.
Names in derived classes hide names in base classes, which is not desirable in public inheritance. To fix it, employ using
declarations or forwarding functions to make hidden names visible again.