I'm doing a restaurant management program. Right now I'm trying to output private vector data and am getting stuck.
So I have a Menu.h
private:
vector<Category> categories;
vector<Menu_Item> menu_items;
vector<Recipe> recipes;
vector<Ingredient> ingredients;
vector<Order> orders;
vector<Order_Item> order_items;
And Menu.cpp
Menu.read()
Menu.show()
The read function reads from a file like this
1010 Appetizers
1901 Entrees
1576 Desserts
1320 Drinks
And stores those values into the appropriate vector, for example this one would be vector categories.
I also have a .h file for all the different types of things like, Menu_Item.h, Recipe.h, etc. And I store values into the vector like such:
menu_items.push_back(Menu_Item(meniID, catID, rID....
However in Menu_Item.h the values are
private:
int menu_item_id;
int cat_id;
int recipe_id;
string menu_item_name;
double price;
The show() function queries the user what he/she wants to see. Let's say the user wants to see a specific menu item like Onion rings. What I can't do is
if(menu_items[0].menu_item_name == "Onion Rings")
because it says that menu_item_name value is private within Menu_Item.h. How can I access the private data?