guys. I see several cases like:
class Derived:public Base{
public:
Derived(...):Base(...){}
}
Is what situation or is there any principle
If don't explitily initialize the base class, the default constructor will be called.
A good coding standard will recommend you to always initialize base class in the constructor's initialization list.
If the constructor of the base class requires some arguments, then you have to do it.
In case if we need to pass the arguments of derived constructor to the base constructor, it can be used.
class foo
{
public:
foo() {}
foo( int num ) {}
};
class bar : public foo
{
public:
bar(int barNum): foo(barNum) {}
};
If you have multiple constructor in your base class (basically entry point), So you have choice to call any of them.
If you want to call a base constructor with arguments.