class car {
int speed;
double position;
public:
car(int v,double d);
int getspeed();
};
int car::getspeed() {
return speed;
}
car::car(
The names of parameteres are not important. Types of parameteres create the signature. The signature is the same, so there is no compile error.
In second example speed in constructor will shadow speed atribute. Therefore you will assign parameter value to parameter variable. You need:
this->speed = speed;
And this is not guesswork ;-).