/* University College London Dept of P&A course in C++ 3C59 | all rights reserved 2000 | | Module: Polymorphism: | | Title: SuperHero exercise | | | Author: P.Clarke */ #include #include "SuperHero.h" // ============================================================================== // Here is the core of the excercise // // This function called battle() receives two SuperHeros polymorphically. // so that it may really be passed all sorts of sub-classes of the SuperHero class // // Many of the methods it calls are virtual and will hence be overridden // void battle( SuperHero& one, SuperHero& two ) { // This is the most trivial way to decide the outcome // Realy you would use a random number mechanism, but we wont complicate here // Note that crucially any overriden virtual power() methods will be called. if( one.power() > two.power() ) { std::cout << one.announce() << " vanquishes " << two.announce() <