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. Create a class named JewelryBox that inherits from PlainBox which in turn inherits from BoxInterface.
a. Create 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. Create 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. Create an instance of type JewelryBox and another of type JewelryBox using pointers (Polymorphism) of type BoxInterface. Request user data and print your content.
(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::PlainBox() {
cout << "PlainBox constructor executing\n";
}
template
PlainBox::PlainBox(const ItemType& theItem) {
setItem(theItem);
}
template
PlainBox::~PlainBox() {
cout << "PlainBox destructor executing\n";
}
template
void PlainBox::setItem(const ItemType& theItem) {
item = theItem;
}
template
ItemType PlainBox::getItem() const {
return item;
}
#endif
++++++++++++++++++++++++++++
Respuestas a la pregunta
Contestado por
0
Respuesta:
Yo no ablar inglis
XDD
Explicación:
AN SORRI
Otras preguntas
Matemáticas,
hace 3 meses
Matemáticas,
hace 3 meses
Química,
hace 3 meses
Salud,
hace 6 meses
Ciencias Sociales,
hace 6 meses
Matemáticas,
hace 11 meses
Inglés,
hace 11 meses