Question: Given the following output and main function and write the class definitions for the Jedi, Master, and Padawan class. Master and Padawan inherit from Jedi.
Given the following output and main function and write the class definitions for the Jedi, Master, and Padawan class. Master and Padawan inherit from Jedi. Write the three classes and all function definitions. Jedi should have two private members: a boolean called m_isSith, and a string called m_name. It should have a constructor, a getter and setter for name, a function is Sith (the getter for m_isSith), and a void function called goToTheDarkSide(), which will set m_isSith to true and print \"JEDINAME has gone to the dark side\" where JEDINAME is the name of the jedi (m_name). The Master class should have one void function called specialMove that prints out a message that matches the desired output. The Padawan should have a similar function called attack, that prints out a message depending on the value of issith. You can be creative for what the padawan says when isSith is false. /*expected output Anakin has gone to the dark side!Anakin attacks! Obi Wan jumps! Obi Wan now has the high ground. #include #include I/Write Jedi, Master, and Padawan terrel anar del int maino Master jedi1; Padawan jedi2: jedi1.setName(\"Obi Wan\"); jedi2.setName(\"Anakin\"); jedi2.goToTheDarkSide(); jedi2.attack(); jedi1.special Move(); return 0;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
