Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- // Doesn't this code looks familar? Hm.
- // This looks a bit complex, please look at the code piece by piece
- // What two functions did kfcStore get?
- class kfcStore
- {
- public:
- void setMenuName(string name)
- {
- menuName = name;
- }
- string getMenuName()
- {
- return menuName;
- }
- void makeFoodFunction(string menuName)
- {
- // It appears we added something here. What did we add exactly?
- // Don't tell me getMenuName()...Haha.
- cout << "Hamburgers and " << getMenuName() << endl;
- }
- // Do you recall the differences between public and private access specifiers?
- private:
- string menuName;
- };
- int main()
- {
- string dollarMenu;
- kfcStore objectPopcornMachine;
- cout << "May I take your ORDER!?! " << objectPopcornMachine.getMenuName() << endl;
- cout << "What would you like sir?" << endl;
- getline(cin, dollarMenu);
- // So what exactly happened here? Please explain?
- objectPopcornMachine.setMenuName(dollarMenu);
- objectPopcornMachine.makeFoodFunction(dollarMenu);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement