Question: File powers.cpp Note the header file - it's well documented and a good indication of what each function needs to do . Do not

File "powers.cpp"
Note the header file - it's well documented and a good indication of what each function needs to do. Do not change the function declarations in this file (that also means you should not change the function inputs or outputs in the implementation file). You may add any additional functions you need.
The header file contains...
An enum with identifiers for the different powers.
An abstract class Power that is a base class for the other powers.
Six power classes that inherit from Power.
A powerFactory function that generates powers from an inputted string.
The implementation file only has functions for the Power class and the powerFactory. You are to create the functions for all of the individual power classes. The needed functions can be found in the header file.
The Power class has 2 member variables, they are:
The mDescription contains a string set in the child classes. The value is set in the individual power constructors. This is the value that will be displayed when the power is listed for the hero. You may fill in whatever value you want - just make sure it conveys the information about the power. For example, FlightPower might set the mDescription to "Can shoot lasers" or GadgetPower may set it to "Uses some crazy gadgets" Keep the description to a single line of text (no more than 80 characters). There are 5 points of extra credit available for humorous or amusing text here - but it must stay PG rated.
The mPowerID is the POWER_ID enum value corresponding to the appropriate power. This should also be set in the child class constructors.
The Power class has 2 functions you must complete
The getID function should return an enum value from the header file. That value (mPowerID) should be set in the individual power constructors.
The stream operator (operator) should send the power's description (mDescription) to the inputted stream. That value should be set in the individual power constructors.
The Power class has 2 pure virtual functions that the child classes must implement.
The use function will return a string that will be displayed when the power is used.
The fight function return an integer with the results of the fight from the previous table. The possible values are
1 if the current Power wins
0 in the event of a tie
-1 if the current Power loses
Each power has 3 functions to complete. They are
The constructor, which must set the member variables from the base class.
The use function returns a string that will be displayed when the heroes fight each other. You may return any text you'd like. For example LaserPower might return "shoots lasers from their eyes. PEWPEWPEW!" while StrengthPower might return "SMASH!!". Keep the output to a single line of text (no more than 80 characters). There are 5 points of extra credit available for humorous or amusing text here - but it must stay PG rated.
Page 2 of 11
 File "powers.cpp" Note the header file - it's well documented and

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!