I am practicing basic OOP w/ C++ and while using a pointer I found that I did not need to dereference the pointer to assign a value. Why is this? Menu.h:
class Menu { public:
int MenuCount;
int NumItems;
Drinks *Items;
Menu.cpp
Menu::Menu(Drinks a, Drinks b, Drinks c) {
std::cout << "How many items would you like on this menu? "; std::cin >> NumItems;
Items = new Drinks[NumItems];
Items[0] = a; Items[1] = b; Items[2] = c; // why is it I can assign values by pointer without dereferencing?
MenuCount = 3;
To my understanding I would've had to dereference Items with * prior to assigning a new object to the array, nonetheless this code works.