The constructor of PetStore
will call a constructor of Farm
; there's
no way you can prevent it. If you do nothing (as you've done), it will
call the default constructor (Farm()
); if you need to pass arguments,
you'll have to specify the base class in the initializer list:
PetStore::PetStore()
: Farm( neededArgument )
, idF( 0 )
{
}
(Similarly, the constructor of PetStore
will call the constructor of
nameF
. The constructor of a class always calls the constructors of
all of its base classes and all of its members.)