Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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