If I have declared more than one variable of a "class" type I have already defined, how can I be sure which variable I am manipulating. If I have one function which uses "switch" to call functions from the class, can I safely assume that I am altering the "class" variable I am using to call that function with. I'm not at a complier right now, but I am typing up my code based on what I think would work. I would hate to get too deep into this idea if its not even right. Please help!
For example:
Code://#include blah blah Names Male; //can I declare a global class variables like this? Names Female; void Menu (); class Names { public: void Add (); void Drop (); private: //blah blah }; void main () { Menu (); } void Menu () { cout <<"1. blah blah\n2. blah blah\n"; cout <<"Please run option: "; cin >>choice; if (choice == 1) Male.RunOption (); else if (option == 2) Female.RunOption (); } void Names :: RunOption () { switch (choice) { case 1: Add (); break; case 2: Drop (); break; default: cout <<"not an option"; Menu (); break; } }