Run ❯
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
using namespace std; // Base class class Vehicle { public: string brand = "Ford"; void honk() { cout << "Tuut, tuut! \n" ; } }; // Derived class class Car: public Vehicle { public: string model = "Mustang"; }; int main() { Car myCar; myCar.honk(); cout << myCar.brand + " " + myCar.model; return 0; }
Tuut, tuut!
Ford Mustang