/********************************************************************* C201 Computer Programming II Fall 2006 Dana Vrajitoru & A class to represent products in stock in a shop. **********************************************************************/ #ifndef PRODUCT_H #define PRODUCT_H #include using namespace std; enum Category {food_ty, health_ty, cloth_ty, home_ty}; class Product { private: char name[20]; Category type; int quantity, barcode; float price; public: // Constructors. // Default constructor. Product(); //Copy constructor. Product(Product &data); //Initializing functions. void Init(); void Init(Product &data); // Overloaded operators // Assignment operator. Product &operator=(Product &data); // Input-output void Input(); void Output(); // Data manipulation. // Add more products to the stock. void Add(int how_many); // Remove some products from the stock. It needs to be a bool // because if we don't have that many items in the stock we can't // remove them. bool Remove(int how_many); // Declare a friend class to give it full access to this one. friend class Inventory; // An overloaded output operator so that we can use a product // object in a cout << statement. friend ostream &operator<<(ostream &out, Product &data); // An overloaded input operator so that we can use a product // object in a cin >> statement. // friend istream &operator>>(istream &in, Product &data); }; #endif