An error code 2664 pops up for this program I am working on and I can't figure out how to fix it.
It specifically says: error C2664: 'menu::menu(const menu &)' : cannot convert parameter 1 from 'const char [43]' to 'const menu &' for c++\invtyapp.cpp
The problem is in my Invtyapp.cpp which looks like this:
#include "InvtyApp.h"
InvtyApp::InvtyApp()
{
Mo = new menu("ACDLE, Select one of the following options"); //error is //found on this line on first parenthesis.
else
{
system("cls");
cout << endl << endl << flush;
cout << "Inventory alread exists. \nYou must delete Inventory before you may add Inventory";
cout << "\n\n\nPlease press any key to continue" << flush;
getch();
}
}
void InvtyApp::DelInv()
{
system("cls");
if(I->get_InvNumber() == 0)
{
cout << "\nThere is no Inventory. You must add Inventory";
cout << "\nbefore you may delete an employee\n\n"<<flush;
}
else
{
I->Clear();
cout << " Inventory Record Deleted!\n\n";
}
cout << " Press any Key";
getch();
}
void InvtyApp::ChgInv()
{
char ch;
system("cls");
if(I->get_InvNumber() == 0)
{
cout <<"\n\nThere is no employee. You must add an employee";
cout <<"\nbefore you may change Inventory\n\nPlease press any key to continue"<<flush;
getch();
}
else
{
EditInv();
cout << endl << endl << endl<< endl << endl;
cout << "n\nDo you want to save this record?"<<flush;
do
ch=toupper(getch());
while((ch != 'Y') && (ch != 'N'));
if(ch=='Y')
{
I->set_InvNumber(INumfld);
I->set_NumberItemStock(NumbItemfld);
I->set_ItemPrice(ItemPricefld);
}
}
}
menu::menu(char *vs,char *inst) // I believe that I need to change this part //around but I don't know how I should change it to incorporate the const menu &
{
valid_selects = new char [strlen(vs) + 1];
strcpy(valid_selects,vs);
instruct = new char[strlen(inst)+1];
strcpy(instruct,inst);
iter = pL.begin();
getch();
}
char menu::get_choice()
{
char ch = 0;
do
ch=toupper(getch());
while(!strchr(valid_selects,ch));
return ch;
}
I posted this on the beginners forum and didn't receive much help. This only includes 3 of the 7 files that I have written but I really feel like the problem resides within these 3. I can post the other code for the other four files if necessary. Any help would be greatly appreciated. I have been working on this for a long time and I can't seem to fix this one problem. This is the final problem to fix in order to make this program run and I can't seem to make it work. If you could provide a detailed solution or even point me in the right direction to figure out what I need to do I would really be thankful.
Thank you all