I got an error message before i added the copy constructor saying"error no matching function for call to Item::Item", which means i need a copy constructor.the error happens at the line that the constructor is created for Inventory. also am i doing the right thing by assigning the public array inventory to the private array inventory, im not sure if it is ok. and on my copy constructor xcode is saying that those variables are not being used, why? Now the new error that xcode gives for the Inventory constructor, says "new types may not be defined as a return type." thats the main problem now.
thanks in advance
Code:
#include <iostream>
using namespace std;
const int SIZE = 100;
class Item {
char *item;
double cost;
double retail;
int on_hand;
int lead_time;
public:
Item(char *item, double cost, double retail, int on_hand, int lead_time);
Item(const Item &obj);
void setItem(char *c){item = c;}
void setCost(double *d){cost = *d;}
void setRetail(double *d){retail = *d;}
void setOnHand(int *hand){on_hand = *hand;}
void setLeadTime(int *time){lead_time = *time;}
char *getItem(){return item;}
double getCost(){return cost;}
double getRetail(){return retail;}
int getOnHand(){return on_hand;}
int getLeadTime(){return lead_time;}
};
Item::Item(char *item, double cost, double retail, int on_hand, int lead_time){
this->item = item;
this->cost = cost;
this->retail = retail;
this->on_hand = on_hand;
this->lead_time = lead_time;
}
Item::Item(const Item &obj){
char *item = obj.item;
double cost = obj.cost;
double retail = obj.retail;
int on_hand = obj.on_hand;
int lead_time =obj.lead_time;
}
class Inventory {
Item invntry[SIZE];
char *name;
Inventory(char *name);
public:
char *getName(){return name;}
}
Inventory::Inventory(char *name){
this->name = name;
Item inventory[SIZE] = invntry;
}
int main () {
return 0;
}