push_back(new triangle)

Hi,

In C++ by FLTK, to define a circle we use some code like this:

Circle c(Point(x,y), r);

And we can using vector_ref put and save them in a vector, like:

1
2
Vector_ref<Circle> vc;
vc.push_back(new Circle(Point(x,y),r));


OK, those were about Circle and no problem till now!
Triangle can be defined like this for using in codes:

1
2
3
4
Graph_lib::polygon poly;
poly.add(Point(x1,y1),r1);
poly.add(Point(x2,y2),r2);
poly.add(Point(x3,y3),r3);

and this is a vector to saving them:

Vector_ref<Graph_lib::Polygon> vp;

The problem is that how to save/put triangles/polygons into that vp vector using new keyword like the circle does?




My sig: Save Cobani.
Last edited on
Topic archived. No new replies allowed.