Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ programming

Name: Anonymous 2011-09-26 20:21

Can someone explain to me why my compiler gives me an overload error.

//Class
class Car
{
private:
      int year;
      string make;
      int speed;
public:
       Car(int, string);
       int getSpeed(int);
   
//Accessors
      int getSpeed(int speed2)
      {                       <--- Error line!
          speed = speed2;
         
          cout << "The current speed is :" << speed << endl;
         
          return speed;
      }

//Functions     
int accelerate()
{
     speed = speed + 5;
    
     return speed;
}

int brake()
{
    speed = speed - 5;
      
    return speed;
}

};

This is my entire class. Please help. Can provide more if needed.

Name: Anonymous 2011-09-26 20:23

Here is my class constructor.

//Constructor
Car::Car(int year2, string make2)
{
          year = year2;
          make = make2;
          speed = 0;
         
};

Name: Anonymous 2011-09-26 20:26

Actually I think I just figured it out.

Name: all-insanity 2011-10-14 2:55

It’s getting hotter and hotter; clothes people wear are fewer and fewer. Whatever your figure is, it will appear in others’ eyes. If you have a perfect shape, you are certain to be happy when people praise and envy you. Instead, if your figure is not in shape, you may be laughed at. However, Insanity’s emergence will change the latter situation. Insanity workout is a unique home fitness program which doesn't need any equipment and includes 10 workout DVDs. It just takes your 60 days. Then an amazing result will kiss you. Change the figure you don’t like and you will find Insanity is a good choice. You can search the following: insanity wolf, definition of insanity, insanity calendar, insanity quotes, insanity results, insanity test, insanity definition, criminally insane, insanity nutrition guide, insanity plea, insane definition to find us at http://www.all-insanity.com

Don't change these.
Name: Email:
Entire Thread Thread List