#include <iostream> using namespace std; class Vehicle { public: void printCategory() { cout << "Generic Vehicle\n"; } }; class Car : public Vehicle { public: void printCar() { cout << "Car Vehicle\n"; } }; int main() { Car c; c.printCategory(); c.printCar(); return 0; }
Solution Explanation
Layman’s Terms
A car is just a specialized vehicle. It inherits everything that makes it a vehicle and adds its own unique description.
Significance for Embedded Developers
This models situations like:
Test Cases
Test Results
Input
Expected Output
Generic Vehicle Car Vehicle