class Derived:public Base
{
public:
Derived():Base() //unsure of syntax here
{
//initialize some values that were not in base constructor, referencing protected variables in base class
}
}:
int main()
Base ** group;
group = new Base * [number];
group[0] = new Derived(arg 1, arg 2, arg 3, arg 4);
My question:
The derived call in the main with the 4 arguments are the identical 4 arguments the base class constructor fills. It would be the same as if I went new Base(arg 1, arg 2, arg 3, arg 4)
it fills in the exact same data. This is desired. All I want the derived constructor do is fill in NEW data (not taking any new arguments).
How do I get the derived constructor to use the base constructor? Currently the error is "No instance of constructor Derived::Derived matches the argument list.
class Derived() : public Base //Here, it says "Expected an identifier" on the closing parenthesis and "expected a ;" on the colon...
{
public:
Derived::Base();
{
//some assignments to protected variables in base class
}
};
int main()
{
group[0] = new Derived(arg 1, arg 2, arg 3, arg 4); //here, derived is underlined and says "incomplete type name not allowed
}