Lets say I have a class named Car and another which inherits from Car called SuperCar. How can I ensure that Car's costructor is called in SuperCar's constructor? Do I simply do: Car.Car(//args);?
Thanks
Sample classes with no member vars.
class Car {
Car(); /*If you want default objects*/
Car(/*arg list*/); /* maybe multiple constructors with different, count and
type args */
};
class SuperCar {
SuperCar(/*args list*/) : Car(/*arg list*/){/*Constructor Body*/}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With