#include #include #include int main() { std::vector bag { // Sword { "Sword of stabbing", 10.0, 2.5 }, // Sword { "Sword of pricking", 5.0, 0.9 }, // Bow { 7.5, 0.6 }, // Shovel { } }; double total_weight { 0.0 }; double greatest_damage { 0.0 }; std::cout << "Your bag contains: " << std::endl; for (/* Item */ item : bag) { std::cout << " - "; item->print(std::cout); std::cout << std::endl; // if (item is a weapon) // { // if (weapon->get_damage() > greatest_damage) // { // greatest_damage = weapon->get_damage(); // } // } total_weight += item->get_weight(); } std::cout << "Total weight: " << total_weight << " kg" << std::endl; std::cout << "Best damage: " << greatest_damage << " damage" << std::endl; }