OOP HomeWork

This commit is contained in:
e2hang
2025-08-11 00:01:30 +08:00
commit e8a5ca2363
119 changed files with 3187 additions and 0 deletions

34
oop_hw5/hw2/animal.h Normal file
View File

@@ -0,0 +1,34 @@
#pragma once
#include <iostream>
#include <cstring>
class Animal {
private:
std::string name;
int weight;
public:
Animal();
Animal(std::string n, int w);
std::string show_name();
int show_weight();
void change_name(std::string cn);
void change_weight(int cw);
virtual void who();
protected:
};
class Lion : public Animal {
public:
Lion();
Lion(std::string n, int w);
void who();
};
class Aardvark : public Animal {
public:
Aardvark();
Aardvark(std::string n, int w);
void who();
};