#include <iostream>

using namespace std;

class Vehicle{
public:
    int numWheels;
    int numCylinders;
    virtual int getNumWheels(){return numWheels;}
    virtual void printNumWheels(){cout << "V print wheels: " << numWheels<<endl;}
    Vehicle(int numW = 4, int numCyl= 8);
    virtual ~Vehicle(){ cout << "Vehicle destructor\n";} //try removing virtual keyword
};

class Car: public Vehicle{
public:
    int numDoors;
    Car(int numD = 2);
    char * model;
    ~Car(){ delete [] model; cout << "Car destructor\n";}
    virtual int getNumWheels(){return 3;} //shadows the def of this name in Vehicle
};

int main(){

    Vehicle * v1Ptr = new Car();
    cout << "v1Ptr: "<< v1Ptr->getNumWheels() << endl;
    delete v1Ptr;
    return 0;
}

void f(){
    Car c;
}

Vehicle::Vehicle(int numW, int numCyl): 
    numWheels(numW), 
    numCylinders(numCyl) {
    cout << "new Vehicle\n\n";
}

Car::Car(int numD): 
    Vehicle(4, 4), 
    numDoors(numD)
{
    cout << "new Car\n";
    model = new char[30];
}

