dimanche 28 février 2021

Calling class vector after storing another class inside the vector

heres my code, vector class lines2D

vector<Line2D> lines2D;

lines2D.push_back(Line2D(Point2D(xAxis, yAxis), Point2D(zAxis, wAxis)));

Stored data into the lines2D vector with another class Point2D constructor.

but now how do I call it to display the data inside the vector lines2D?

usually I would use for(int i =0; i<lines2D.size();i++) { cout << lines2D.at(i) << endl; }

But with the another class method in it i was not able to figure out the syntax.

I want to get results like

line2D.pt1.getX(), line2D.pt1.getY() line2D.pt2.getY(), line2D.pt2.getY()

basically to get the Point2D(x, y) Point2D(x, y) that is stored in my Line2D class.

Aucun commentaire:

Enregistrer un commentaire