Search code examples
c++overloadingusingderived-class

`using` keyword for default behaviour from the base class


I don't really understand when I need the using keyword. Do you always need it when you want to use a function or object from the base class? I find I have to use it even when I'm not overloading the function.


Solution

  • There are only two cases where you need to use using in a class. First is when you are defining a function in the class with the same name as one in the base class, and you want to use overloading with both of them considered. The other is when you want to use the base class constructor as the derived constructor.