class MenuItem
1: /** @file menuitem_base.h */
3: #include <string>
4: using namespace std;
6: class MenuItem
7: {
8: public:
10: void setOption
11: (
12: const string& optionText
13: )
14: /**<
15: @pre optionText has been initialized with the text of the menu
16: item corresponding to the action to be performed by performAction().
17: @post objectText of self has been initialized with objectText input.
18: */
19: {
20: this->optionText = optionText;
21: }
23: string getOption() const
24: /**<
25: @post Return value is optionText, the text of the menu item
26: corresponding to the action to be performed by performAction().
27: */
28: {
29: return optionText;
30: }
32: virtual void performAction() = 0;
33: /**<
34: Pure virtual function that must be implemented in any derived class
35: if objects of that derived class are to be instantiated. Its action
36: should correspond to the action indicated by the return value of
37: getOption().
38: */
40: private:
42: string optionText;
43: //Text of menu item corresponding to action performed by performAction().
44: };