Dillinger4
Jun 25th, 2000, 07:22 AM
Im making {or trying to make} a car simulator in C++
It is a console application, but i keep getting this error
C2504. Undefined base class.
#include "Odometer.h"
//this is the base class
class Car
{
public:
// class constructor to initilize objects as they are created
// and to ensure that data members contain vaild values
Car(bool B = false, bool A = false)
{
m_brake(B);
m_accelerator(A);
}
void set_temp(); // member functions prototype
void start_engine();
void kill_engine();
void set_gas();
void set_brake();
void change_gears();
void change_direction();
int get_speed();
int get_fuel();
int get_distance();
int get_RPM();
int get_temp();
char m_brake; // data members
char m_accelerator;
};
// derived class in another file
// class defination for our odometer
class Odometer: public Car
{ // error is generated here when compiled Do i have to
public: // use the extern keyword to specify external
// linkage ?????? That's the only thing i can
// think of
Odometer(long dt = 0) // class constructor
{
m_distance_trav(dt);
}
int reading(int cur_speed); //function prototype
long m_distance_trav;
};
// thanks all!!!
};
It is a console application, but i keep getting this error
C2504. Undefined base class.
#include "Odometer.h"
//this is the base class
class Car
{
public:
// class constructor to initilize objects as they are created
// and to ensure that data members contain vaild values
Car(bool B = false, bool A = false)
{
m_brake(B);
m_accelerator(A);
}
void set_temp(); // member functions prototype
void start_engine();
void kill_engine();
void set_gas();
void set_brake();
void change_gears();
void change_direction();
int get_speed();
int get_fuel();
int get_distance();
int get_RPM();
int get_temp();
char m_brake; // data members
char m_accelerator;
};
// derived class in another file
// class defination for our odometer
class Odometer: public Car
{ // error is generated here when compiled Do i have to
public: // use the extern keyword to specify external
// linkage ?????? That's the only thing i can
// think of
Odometer(long dt = 0) // class constructor
{
m_distance_trav(dt);
}
int reading(int cur_speed); //function prototype
long m_distance_trav;
};
// thanks all!!!
};