class car {
int speed;
double position;
public:
car(int v,double d);
int getspeed();
};
int car::getspeed() {
return speed;
}
car::car(int s, double x){
speed=s;
position=x;
}
Even though i specified different variables for car(int s,v), why does it work? i though it should give me a compile time error?
this code:which var it uses?
class car {
int speed;
double position;
public:
car(int speed,double time);
int getspeed();
};
int car::getspeed() {
return speed;
}
car::car(int speed, double position){
speed=speed;
position=position;
}
I think the global variable might be used, or is it something you can't say certain about
thisis always a valid symbol in member function scope. Always.