Code:
#include<iostream.h>
#ifndef VEHICLE_H
#define VEHICLE_H
class vehicle //base class declaration
{
private:
int itsDoors;
int itsCylinders;
int itsEngineSize;
int itsWheels;
float wheelWeight;
};
void InputCarInfo (vehicle buildCar)
{
cout << "How many doors would you like.\n";
cin >> buildCar.itsDoors;
cout << "How many cylinders do you want\n";
cin >> buildCar.itsCylinders;
cout << "How many wheels do you need on the vehicle\n\n";
cin >> buildCar.itsWheels;
}
void DisplayCarInfo (vehicle yourCar)
{
cout << "The vehicle you built has " << yourCar.itsDoors << " doors, " << yourCar.itsCylinders << " cylinders, and " << yourCar.itsWheels << " wheels.\n";
}
This cannot work properly because you are trying to use private data as if it were public.
for instance look at this line....
cin >> buildCar.itsDoors;
buildCar.itsDoors is private to the class so you have no access to it from outside of the class unless you make it public or add accessor/mutator functions to your class.