//Vars to know about
Square* square;
vector<Shape> shapes;

I'm trying to add things that are shapes, or in this instance square (which inherits from shape), but whenever I call shapes.push_back(square), I get this error message:

draw.cpp:55: error: request for member ‘push_back’ in ‘shapes’, which is of non-class type ‘std::vector<Shape, std::allocator<Shape> >*’
draw.cpp:57: error: request for member ‘size’ in ‘shapes’, which is of non-class type ‘std::vector<Shape, std::allocator<Shape> >*’

Recommended Answers

All 2 Replies

The vector isn't expecting a pointer. Change the vector to this if you want pointers: vector<Shape*> shapes;

Yay! No errors!! Silly, pointers... still getting used to where to put the * and where not to.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.