Member function

Cans someone give me an example of an inline function that accepts two variables that sets two private member variables. Did i do something wrong there?
1
2
3
4
5
6

private:
int r1:
int r2:
public:
int Value(int w,int d){return w =r1, d= r2;}
You can't return two values. Also the function type can be void instead of int because you don't need to return any values if you're just changing them.
Try this:
void Value(int w, int d) {r1 = w; r2 = d;}
Last edited on
Topic archived. No new replies allowed.