class ITEM base class for two clasees
| 20 | |
| 21 | // class ITEM base class for two clasees |
| 22 | class Item { // class ITEM which includes the name and universal item code |
| 23 | protected: |
| 24 | string name; |
| 25 | string UIC; |
| 26 | public: |
| 27 | Item() { // default constructor |
| 28 | name = "Unknown"; |
| 29 | UIC = "Unknown"; |
| 30 | } |
| 31 | |
| 32 | Item(string name, string UIC) { // parametirized constructor |
| 33 | this->name = name; |
| 34 | this->UIC = UIC; |
| 35 | } |
| 36 | |
| 37 | void set_name(string name) { // function for inputing the name of item |
| 38 | this->name = name; |
| 39 | } |
| 40 | |
| 41 | void set_UIC(string UIC) { |
| 42 | this->UIC = UIC; |
| 43 | } |
| 44 | |
| 45 | string get_name() { |
| 46 | return name; |
| 47 | } |
| 48 | |
| 49 | string get_UIC() { |
| 50 | return UIC; |
| 51 | } |
| 52 | |
| 53 | void virtual display() { |
| 54 | cout << left << setw(20) << name << setw(15) << UIC; |
| 55 | } |
| 56 | |
| 57 | void virtual input() { |
| 58 | cout << "Enter the name of a new product: "; |
| 59 | cin >> name; |
| 60 | cout << "Enter the UIC of a new product: "; |
| 61 | cin >> UIC; |
| 62 | } |
| 63 | |
| 64 | }; |
| 65 | |
| 66 | // class for Packed Products |
| 67 | class PackedGroceries : public Item { |
nothing calls this directly
no outgoing calls
no test coverage detected