#include "ship.h" #include //Ship Ship::Ship(std::string const& n, int w) : name{n}, weight{w} {} std::string Ship::print_string() const { return "name: " + name + ", weight: " + std::to_string(weight) + " power: " + std::to_string(get_power()); } //WarShip WarShip::WarShip(std::string const& n, int w, int g) : Ship(n, w), guns{g} {} unsigned int WarShip::get_power() const { return weight * guns; } //CargoShip CargoShip::CargoShip(std::string const& n, int w, int c) : Ship(n, w), cargoCapacity{c} {} unsigned int CargoShip::get_power() const { return weight + cargoCapacity; }