add solution of lab01

This commit is contained in:
2025-01-20 02:18:25 -05:00
parent 0dd22a2682
commit 8b451ff045
5 changed files with 141 additions and 11 deletions

28
labs/classes/Animal.h Normal file
View File

@@ -0,0 +1,28 @@
#include <string>
class Animal {
public:
Animal(const std::string &name);
std::string getName() const;
void setWeight(double new_weight);
double getWeight() const;
void setCanSurviveOnLand(bool can_land);
bool canSurviveOnLand() const;
void setCanSurviveInWater(bool can_water);
bool canSurviveInWater() const;
void setEatsMeat(bool meat);
bool eatsMeat() const;
void setEatsPlants(bool plants);
bool eatsPlants() const;
bool isOmnivore() const;
bool isAmphibious() const;
private:
std::string name_;
double weight_;
bool can_survive_on_land_;
bool can_survive_in_water_;
bool eats_meat_;
bool eats_plants_;
};