0

I have a Triangle class which has members

`Point P1, P2, P3;`

So generally I pass the constructor 3 points.

```
Point A(1,1,1);
Point B(1,1,0);
Point C(0,0,1);
Triangle T(A,B,C);
```

Then I have a bunch of functions that I can pass point's to such as to find intersections and distances etc.

However, now I would like to make a triangle which stores pointers to points, so that when I change the positions of the points, the triangle is automatically updated.

Ie.

```
Point A(1,1,1);
Point B(1,1,0);
Point C(0,0,1);
Triangle(&A, &B, &C);
```

This way when I do

`A.setX(3);`

The triangle now thinks the points (3,1,1), (1,1,0), (0,0,1) are its three points.

Is there some way to do this dual functionality in one class? Or do I need to make a ValueTriangle and a PointerTriangle class?

Thanks,

Dave