How to write a menu as a class

Hi,
I have the task to make a class "account" with which you can manage one bank account. Already wrote that and I am satisfied with what I have.
Now I have to extend the program by writing a menu.
If possible it should be written in a separate class "menu".
Every of my attempts so far with creating such a class has been fruitless.
I guess "menu" should inherit from "account" so I'm able to use the methods of "account" in the menu right?

"menu" shall be able to get the status of an account and manipulate the deposit.
All necessary methods already have been implemented in "account" already,
but I don't seem to be able to use them in "menu".

I don't need code but a good explanation of which class has to inherit and why.
Maybe also a good approach for creating "menu".
"Extend" generally implies inheritance (actually, java uses the keyword "extends" for their inheritance).

If you have a class:
1
2
3
4
5
6
MyClass
{
public:
  DoA();
  DoB();
};


Then you could probably implement it like so:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
MyClassWithMenu : MyClass
{
public:
  Go ()
  {
    bool exit = false;
    int choice;
    while ( m_exit )
    {
      cout << "1. Do A\n2. Do B\n";
      cin >> choice;
      switch(choice)
      {
      case 1: DoA(); break;
      case 2: DoB(); break;
      case 3: exit = true; break;
      }
    }
  }
};
Topic archived. No new replies allowed.