Using char and virtual char in my class.. need help!

I need help instead of using void for menuDisplay() why would I need to use virtual char? and void for menuChoices() how can I use char instead? I am going to create a class called choices that will handle what the choice returns from BaseMenu. right now I am a little lost please help me!
(This is not a class assignment due !)


Here is my code for BaseMenu.h:
class BaseMenu
{
public:
      void menuHeader();
      void menuDisplay();
      void menuChoice();
};
 
Here is the code for BaseMenu.cpp:
#include <iostream>
#include "basemenu.h"
#include "messages.h"
using namespace std;
 
char choice;
bool done = false;
Messages mess;
 
void BaseMenu::menuHeader()
{
      cout << "******************\n";
      cout << "****** MENU ******\n";
      cout << "******************\n";
}
void BaseMenu::menuDisplay()
{
      cout << "***(H)ello     ***\n";
      cout << "***(W)elcome   ***\n";
      cout << "***(O)ther menu***\n";
      cout << "***(Q)uit      ***\n";
      cout << "******************\n";
}
void BaseMenu::menuChoice()
{
      cout << "Choice: ";
      cin >> choice;
      cout << endl;
}
 
now for SubMenu.h
class SubMenu
{
public:
      void newMenu();
};
 
code in SubMenu.cpp:
#include <iostream>
#include "submenu.h"
#include "basemenu.h"
 
using namespace std;
BaseMenu bmenu;
 
void SubMenu::newMenu()
{
      bmenu.menuHeader();
      cout << "***(B)ye       ***\n";
      cout << "***(L)augh     ***\n";
      cout << "***(Q)uit      ***\n";
      cout << "******************\n";
}

Open in new window

jschmuffAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Infinity08Connect With a Mentor Commented:
See this post of me in one of your other questions :

        http://www.experts-exchange.com/Programming/Languages/CPP/Q_22995532.html#20390859
0
 
Jaime OlivaresSoftware ArchitectCommented:
where is the virtual char issue in your code?
You use virtual when you will have a derived class' method with the same name.
0
 
ravenplCommented:
Is that what You want(You don't want virtual I guess)
char BaseMenu::menuChoice()
{
      char c;
      cout << "Choice: ";
      cin >> c;
      cout << endl;
      return c;
}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.