- Apr 13, 2000
- 2,353
- 0
- 0
OK:
class rect
{
private:
float xcoord, ycoord, radius, mass, dxstep, dystep;
public:
rect()
{
xcoord = 0.0;
ycoord = 0.0;
radius = 0.0;
mass = 0.0;
dxstep = 0.0;
dystep = 0.0;
}
rect(float x, float y, float r)
{
xcoord = x;
ycoord = y;
radius = r;
mass = r * r;
dxstep = 0.0;
dystep = 0.0;
}
<< insert all of the standard get & set routines here! >>
void function1(rect r)
{
function2(r)
}
void function2(rect r)
{
....
}
I call function1 from main (rectangle1.function1(rectangle2) and then in function1 I can modify both:
the private members of rectangle1 (xcoord, ycoord etc)
and
the member functions of rectangle2 (getx, gety, sety etc)
When it passes rectangle2 to function2 does this change? Because is sure seems to!
Cheers, Seb
class rect
{
private:
float xcoord, ycoord, radius, mass, dxstep, dystep;
public:
rect()
{
xcoord = 0.0;
ycoord = 0.0;
radius = 0.0;
mass = 0.0;
dxstep = 0.0;
dystep = 0.0;
}
rect(float x, float y, float r)
{
xcoord = x;
ycoord = y;
radius = r;
mass = r * r;
dxstep = 0.0;
dystep = 0.0;
}
<< insert all of the standard get & set routines here! >>
void function1(rect r)
{
function2(r)
}
void function2(rect r)
{
....
}
I call function1 from main (rectangle1.function1(rectangle2) and then in function1 I can modify both:
the private members of rectangle1 (xcoord, ycoord etc)
and
the member functions of rectangle2 (getx, gety, sety etc)
When it passes rectangle2 to function2 does this change? Because is sure seems to!
Cheers, Seb