+ 2

SOLVE Code block cant process protected inheritance

help me.. the error says enemy::attack power is protected https://code.sololearn.com/c1A54u4alJ4H/?ref=app

28th Aug 2018, 12:41 PM
Muhamad Fathi Zuhaili
Muhamad Fathi Zuhaili - avatar
2 Answers
+ 2
I assume you fixed it as I don't get an error.
30th Aug 2018, 11:23 AM
John Wells
John Wells - avatar
0
Polymorphism Fill in the blanks to declare Enemy pointers to the ''Ninja'' and ''Monster'' objects. Set the ''attackPower'' of those objects via ''Enemy'' pointers, then call attack() functions of both ''Ninja'' and ''Monster'' objects: Enemy * e1 = &ninjaObj; Enemy* e2 = &monsterObj; e1->setAttackPower(29); e2->setAttackPower(99); ninjaObj.attack(); monsterObj.attack();
28th Aug 2021, 2:50 AM
Ashis Kumar Behera
Ashis Kumar Behera - avatar