Answered step by step
Verified Expert Solution
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
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) { coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started