Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, classes INHERITANCE: Update Event Case Study In this lab, you are going to add a new class Exhibit to the Event inheritance hierarchy.

Using C++, classes

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

INHERITANCE: Update Event Case Study In this lab, you are going to add a new class Exhibit to the Event inheritance hierarchy. Exhibit class will inherit from the Event class. Exhibit class will also have a list of Artifact objects. The following diagram represents the relationships between the classes. Event Is A (Inheritance) Has A (Composition) Exhibit Artifact Helper Class: Artifact The header and implementation files for Artifact class is given below. An Artifact object has a name, origin and era data members all of which are strings. The class also defines constructors, setters, getters and a toString function. Artifact.h #ifndef ARTIFACT_H #define ARTIFACT_H #include class Artifact{ public: Artifact(std::string, std::string, std::string); Artifact(); Artifact(); void setName(std::string); std::string getName()const; void setOrigin(std::string); std::string getOrigin()const; void setEra(std::string); std::string getEra()const; std::string toString()const; private: std::string name; std::string origin; std::string era; }; #endif Artifact.cpp #include "Artifact.h" #include #include Artifact::Artifact(std::string name, std::string origin, std::string era) { this->name = name; this->origin = origin; this->era = era; } Artifact::Artifact(){} Artifact:: Artifact(){} void Artifact::setName(std::string name){this->name = name;} std::string Artifact::getName()const{ return name;} void Artifact::setOrigin(std::string origin){ this->origin = origin;} std::string Artifact::getOrigin()const{ return origin;} void Artifact::setEra(std::string era){ this->era = era;} std::string Artifact::getEral)const{ return era;} std::string Artifact::toString()const{ std::ostringstream output; output #include using namespace std; int main() { Artifact al{"Sarcophagus of King Tut", "Ancient Egypt", "1000 BC"}; Artifact a2{"Tiara of Cleopatra", "Ancient Egypt", "500 BC"}; Artifact * list = new Artifact[2]{}; list[0] = a1; list[1] = a2; Exhibit myexhibit{"3/5/2021", "3/7/2021", "Coates Hall", "Rulers of Egypt", list, 2}; cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

3 How the market system answers four fundamental questions.

Answered: 1 week ago

Question

5 The mechanics of the circular flow model.

Answered: 1 week ago

Question

1 The difference between a command system and a market system.

Answered: 1 week ago