constructor error message

This is a discussion on constructor error message within the C++ Programming forums, part of the General Programming Boards category; I was hoping that someone could explain what my error message means. error C2533: 'Inventory::Inventory' : constructors not allowed a ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    11

    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;
    }

  2. #2
    Registered User (*)BLUE's Avatar
    Join Date
    Aug 2002
    Posts
    6
    semicolon.....semicolon.......

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    11
    thanks....................STUPID ME!!!!!!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21