MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / Item

Class Item

Lab_21/e-commerce.cpp:22–64  ·  view source on GitHub ↗

class ITEM base class for two clasees

Source from the content-addressed store, hash-verified

20
21// class ITEM base class for two clasees
22class Item { // class ITEM which includes the name and universal item code
23protected:
24 string name;
25 string UIC;
26public:
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
67class PackedGroceries : public Item {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected