Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ programming, done in visual studio Create a class called SuperHero. The SuperHero class should have a default constructor(that prints Hero created and a destructor(that

C++ programming, done in visual studio

image text in transcribed

Create a class called SuperHero. The SuperHero class should have a default constructor(that prints "Hero created" and a destructor(that prints a message saying the hero was defeated). Every Hero has a name member variable which is NOT public. Every Hero has member functions: saveTheDay(which prints "T'm here to save the day."), setName (which sets the name member variable) and getName Derive 2 classes from SuperHero: DCHero and MarvelHero. Both child classes inherit everything from the parent, but they all have their own version of the saveTheDay function(overriding the function). Both classes should have a constructor and destructor In main, create 3 objects and call the function to set their names; DCHero superMan; //feel free to substitute your favorite heroes here MarvelHero spiderMan; SuperHero wordGirl; Ask the user which Hero they would like to interview. this save function for that hero. Based on their answer, call void save(SuperHero& hero) { 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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

=+Identify the ethical dilemma in this scenario.

Answered: 1 week ago