Question: C++ Rock, Paper, Scissors Game with inheritance Rock, Paper, Scissors Game with Inheritance It should have an int field called strength and a char field

C++ Rock, Paper, Scissors Game with inheritance

C++ Rock, Paper, Scissors Game with inheritance Rock, Paper, Scissors Game with

Rock, Paper, Scissors Game with Inheritance It should have an int field called strength and a char field mplement a class called Tool. called type. You may make them either private or protected. The Tool class should also contain the function void setstrength(int), which sets the strength for the Tool Create 3 more classes called Rock, Paper, and scissors, which inherit from Tool Each of these classes will need a constructor which wil take in an int that is used to initialize the strength field. The constructor should also initialize the type field using 'r' for Rock, "p' for paper, and 's' for Scissors. These classes wil also need a public function bool fight(Too that compares their strengths n the following way Rock's strength is doubled (emporarily) when fighting scissors, but halved (temporarily) when fighting paper. n the same way paper has the advantage against rock and scissors against paper. The strength field shouldnt change in the function, which returns true if the original class wins in strength and false otherwise. You may also include any extra auxiliary functions andor fields in any of these classes. Run the program without changing the main function, and verity that the results are oomect e++ -Nall main.cpp -o test ./test Note I want either a 2 file or 3 fie solution. You need to have a rps.h file, also youTI need a nain.cpp file

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!