#include <iostream> using namespace std; class Vehicle { public: // Implement void printCategory() to print "Generic Vehicle" void printCategory() { cout << "Generic Vehicle\n"; } }; // Define class Car inheriting publicly from Vehicle class Car : public Vehicle { public: // Implement void printCar() to print "Car Vehicle" void printCar() { cout << "Car Vehicle\n"; } }; int main() { Car c; // Call inherited method from Vehicle c.printCategory(); // Call derived method from Car c.printCar(); return 0; }
Test Cases
Test Results
Input
Expected Output
Generic Vehicle Car Vehicle