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 and another of type JewelryBox using pointers. Ask for user data and print your content.

//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::PlainBox() {

cout << "PlainBox constructor executing ";

}

template<class ItemType>

PlainBox::PlainBox(const ItemType& theItem) {

setItem(theItem);

}

template<class ItemType>

PlainBox::~PlainBox() {

cout << "PlainBox destructor executing ";

}

template<class ItemType>

void PlainBox::setItem(const ItemType& theItem) {

item = theItem;

}

template<class ItemType>

ItemType PlainBox::getItem() const {

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!