You do this in the initializer-list of the constructor of the subclass.
class Foo : public BaseClass {
public:
Foo() : BaseClass("asdf") {}
};
Base-class constructors that take arguments have to be called there before any members are initialized.
More Related Contents:
- What is this weird colon-member (” : “) syntax in the constructor?
- Default constructor with empty brackets
- Do the parentheses after the type name make a difference with new?
- What are the rules for calling the base class constructor?
- C++ virtual function from constructor [duplicate]
- Conversion constructor vs. conversion operator: precedence
- How to initialize a const field in constructor?
- What is the default constructor for C++ pointer?
- Scope of variables in if statements
- Who deletes the memory allocated during a “new” operation which has exception in constructor?
- call to pure virtual function from base class constructor
- Destructors of builtin types (int, char etc..)
- Do I really need to implement user-provided constructor for const objects?
- C++: Where to initialize variables in constructor [duplicate]
- avoiding the tedium of optional parameters
- Is a `=default` move constructor equivalent to a member-wise move constructor?
- How to add constructors/destructors to an unnamed class?
- Forwarding all constructors in C++0x
- Struct Constructor in C++?
- Different ways of initializing an object in c++
- Initializing a union with a non-trivial constructor
- Constructor initialization Vs assignment
- No matching function for call to Class Constructor
- Why must initializer list order match member declaration order?
- Class inherited from class without default constructor
- Conflict between copy constructor and forwarding constructor
- Default member values best practice
- Scope resolution operator being used twice
- Calling a constructor to re-initialize object
- C++ Constructor/Destructor inheritance