All submissions

Vehicle Inheritance Public

#include<iostream>
using namespace std;

class Vehicle
{
    public:
        void printCategory()
        {
            cout<<"Generic Vehicle"<<endl;
        }
};

class Car: public Vehicle
{
    public:
        void printCar()
        {
            cout<<"Car Vehicle"<<endl;
        }
};

int main()
{
    Car c;
    c.printCategory();
    c.printCar();
}
Loading...

Input

Expected Output

Generic Vehicle Car Vehicle