Question: In C++ 1. Implement the operators 2. Implement virtual destructors 3. Implement Virtual Member Roles 4. Implement an Abstract Class 7. Use only one file
In C++
1. Implement the operators
2. Implement virtual destructors
3. Implement Virtual Member Roles
4. Implement an Abstract Class
7. Use only one file for each class.
Description of the problem:
1. Implement the JewelryBox class that inherits from PlainBox which in turn inherits from BoxInterface. (The JewelryBox class has to be created)
a. Implement a class named Jewelry with the following attributes:
i. Gender: If the jewelry is for women, men or children
ii. Jewelry Type: If it is ring. necklace, chains, bracelet, earrings
iii. Gold Metal Weight: 24k, 14k, 18k or 24k
iv. Price: Price of the jewelry
v. Metal: Metal type, white gold, yellow, silver ... etc
b. Implement a class named Watches with the following attributes:
i. Gender Watch: Whether the watch is female, male or child
ii. Watch Brands: Ferrari,COACH, Casio, Bilova, Citizen, Boos, etc.
iii. Price: Price of the watch
c. Make an instance of type JewelryBox
(PlainBox and BoxInterface classes are provided. Can be edited to fit the problem)
++++++++++++++++++++
#ifndef _BOX_INTERFACE_
#define _BOX_INTERFACE_
template < class ItemType>
class BoxInterface {
public:
virtual ~BoxInterface() {}
virtual void setItem(const ItemType& theItem) = 0;
virtual ItemType getItem() const = 0;
};
#endif
++++++++++++++++++++++
#ifndef _PLAINT_BOX
#define _PLAINT_BOX
#include "BoxInterface.h"
template
class PlainBox : public BoxInterface
private:
ItemType item;
public:
PlainBox();
PlainBox(const ItemType& theItem);
virtual~PlainBox();
virtual void setItem(const ItemType& theItem);
virtual ItemType getItem() const;
};
template
PlainBox
cout << "PlainBox constructor executing ";
}
template
PlainBox
setItem(theItem);
}
template
PlainBox
cout << "PlainBox destructor executing ";
}
template
void PlainBox
item = theItem;
}
template
ItemType PlainBox
return item;
}
#endif
++++++++++++++++++++++++++++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
