-
constructor error message
I was hoping that someone could explain what my error message means.
error C2533: 'Inventory::Inventory' : constructors not allowed a return type
rror C2264: 'Inventory::Inventory' : error in function definition or declaration; function not called
THIS IS MY CODE
---------------------
#include <iostream.h>
#include <string.h>
#include <conio.h>
class Inventory
{
private:
int sku;
char itemName[20];
public:
Inventory(int=0, char[]="");
void getInventory();
void showInventory();
}
Inventory::Inventory(int s, char n[])
{
sku=s;
strcpy(itemName,n);
}
void Inventory::getInventory()
{
cout << "Enter product SKU: ";
cin >> sku;
cout << "Enter product name: ";
cin.getline(itemName, 20);
}
void Inventory::showInventory()
{
cout << "Product SKU: " << sku << "\n"
<< "Product name: " << itemName << endl;
}
void main (void)
{
Inventory i;
i.getInventory();
i.showInventory();
return;
}
-
Registered User
semicolon.....semicolon.......
-
thanks....................STUPID ME!!!!!!
Popular pages
Recent additions