In a class declaration I'm getting this error on two lines. I get it when I try to declare a piece of member data, an array of pointers to objects with array size of global constant int. The second time I get the error is when I declare a member function which returns a pointer to the same type of object with the array. Both of these are private members of the class.
I know that I'm not missing the ending semicolon for the class declaration for the array and the function return value. I've tried moving the asterisk in my syntax as either close to the variable name, close to the variable type, and in between the two.
class InventorySystem {
public:
InventorySystem();
InventorySystem(int store_id, string store_name);
~InventorySystem();
void set_store_name(string store_name);
void set_store_id(int store_id);
void set_item_count(int item_count);
string get_store_name(void) const;
int get_store_id(void) const;
int get_item_count(void) const;
void BuildInventory(void);
void ShowInventory(void) const;
void UpdateInventory(void);
void Terminate(void) const;
private:
string store_name_;
int store_id_;
InventoryItem *p_item_list_[g_kMaxArray]; // THIS LINE
int item_count_;
InventoryItem* FindInventoryItem(int item_id) const; // THIS LINE
};
class InventoryItem {
public:
InventoryItem();
InventoryItem(bool restocking);
virtual ~InventoryItem();
void set_restocking(bool restocking);
bool get_restocking(void) const;
int get_item_id(void) const;
void Display(void) const;
protected:
int item_id_;
bool restocking_;
};
I'm getting a lot of error messages, but all of them seem to be traced back to these two. I can't get my code to compile and I don't know why. Please let me know if I can provide more relevant information. Thanks.