I have a Points class and a Segment class as follows:
class Points
{
double x;
double y;
int Index=-1;
}
class Segment
{
Points Orig;
Points End;
Segment(const Points& a, const Points& b){Orig=a;End=b}
void ChangeGlobalIndex()
{
do something to change the index of two end points.
}
}
int main()
{
Points p1(0.0,0.0);
Points P2(1.0,1.0);
Segments Line1(p1,p2);
Line1.ChangeGlobalIndex();
}
I want to see the Index of p1 and p2 has changed, but it didn't happen. what is the reason?Since the Segment was construced with the references of the two points.
Regards