View Single Post
Old Mar 2nd, 2006, 10:46 PM   #1
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
base type has incomplete type

Can someone please tell me why i get the error "base class has incomplete type"? I'm just learning my way through c++ so bear with me.

class Vehicle 
{
public: 
    //Vehicle(){intSpeed = 1;}
    //Move();
    int GetSpeed() {return itsSpeed;}
    void Move(){std::cout << " Vehicle is moving at " << itsSpeed << " Km per hour" ;}
    void Turn(){std::cout << "Vehicle is turning left at " << itsTurnSpeed
                    << " degrees per second";}
    void Respond(){std::cout << " Vehicle responding\n";}
    //////
    void Speeding() { if ( itsSpeed > (30))
    {
        std::cout << "You are over the speed limit, please slow down./n Your going" << itsSpeed << "Kilometers/ hour\n";
    }
    else 
    {
        std::cout << "Your under the speed limit. Your at " << itsSpeed << " KM/H at the moment.\n"; 
    ;}
     ////   
    
protected:
   int itsSpeed;
   int itsTurnSpeed;
};

/////////////////////////////////////////////////////////////////////////////////

class Car: public Vehicle
{
public:
    Car() {itsSpeed = 20;} 
    //~Car();
    void SetSpeed (int speed) { itsSpeed = speed;}
    void Speed() { itsSpeed = itsSpeed + 2;}
    void Respond(){std::cout << " I'm a car \n";}
private:
    int itsType;
     
};

///////////////////////////////////////

class Boat: public Vehicle
{
public:
    Boat() {itsSpeed = 5;} 
    //~Car();
    void SetSpeed (int speed) { itsSpeed = speed;}
    void Speeding();
    void Speed() { itsSpeed = itsSpeed + 1;}
    void Respond(){std::cout << " I'm a boat \n";}
private:
    int itsType;
     
};

Next i'm learning virtual functions so i need to get this down first. Any help would be greatly appreaciated. If you need main() just let me know. Though I doupt it will help since main() isn't giving me the error, but one of the classes are.
Eric the Red is offline   Reply With Quote