Question: In c++ , only header file .h and main. Use virtual destructors, use operators, use virtual functions members, use of Abstract class. Create a class
In c++ , only header file .h and main. Use virtual destructors, use operators, use virtual functions members, use of Abstract class.
Create a class named JewelryBox class which 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 garment
v. Metal: Type of metal, 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: Casio, Bulova, Citizen, Rolex, Invicta
iii. Price: Price of the watch
c. Create an instance of type JewelryBox
//class Plainbox
#ifndef PlainBox_hpp
#define PlainBox_hpp
#include
#pragma once
#include
using namespace std;
template<class ItemType>
class PlainBox {
private:
ItemType item;
public:
PlainBox();
PlainBox(const ItemType& theItem);
virtual ~PlainBox();
void setItem(const ItemType& theItem);
ItemType getItem() const;
};
template<class ItemType>
PlainBox
cout << "PlainBox constructor executing ";
}
template<class ItemType>
PlainBox
setItem(theItem);
}
template<class ItemType>
PlainBox
cout << "PlainBox destructor executing ";
}
template<class ItemType>
void PlainBox
item = theItem;
}
template<class ItemType>
ItemType PlainBox
return item;
}; #endif /* PlainBox_hpp */
//class BoxInterface
#ifndef BoxInterface_hpp
#define BoxInterface_hpp
#include
class BoxInterface{
public :
virtual ~BoxInterface() {}
virtual void setItem( const ItemType &theItem) = 0;
virtual ItemType getItem() const = 0;
}; #endif /* BoxInterface_hpp */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
