class Order {
private:
std::vector<Pizza*> ordersVector;
public:
void addNewPizza();
// nothing important
}
CPP FILE
1 2 3 4 5 6
void Order::addNewPizza()
{
Pizza *newPizza = new RegularPizza();
this->ordersVector(ordersVector.end(),newPizza);
}
from some reason , when I check the length of the vector I get that it's 1.
When I try to send the first cell of the vector as an argument to a method :
main.cpp :
1 2 3
Order * pizzaOrders;
pizzaOrders->addNewPizza();
orderNewPizza(pizzaOrders->ordersVector[0]); // problematic line , here the code just freeze
you have problem here pizzaOrders->ordersVector[0].........your std::vector<Pizza*> ordersVector is private member so you haven't permission refer to your private mamber from main...