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

39
oop_hw6/hw4/fruit.h Normal file
View File

@@ -0,0 +1,39 @@
#pragma once
#include <iostream>
class Fruit {
private:
int weight;
int loss;
int DatePassed = 0;
bool Dry = false;
public:
Fruit();
Fruit(int w, int l);
int& checkWeight();
int checkLoss();
void upDate();
void Dryed();
bool isDryed();
virtual void losewater() = 0;
};
class Apple : public Fruit {
private:
public:
Apple() : Fruit(50, 4) {};
//Apple(int, int) = delete;
Apple(const Apple& x) = delete;
void losewater();
};
class Orange : public Fruit {
private:
public:
Orange() : Fruit(30, 3) {};
//Orange(int, int) = delete;
Orange(const Apple& x) = delete;
void losewater();
};