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

28
oop_hw4/hw123/police.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include <iostream>
#include "walker.h"
#include "police.h"
#include "thief.h"
using std::string;
using std::cout;
using std::cin;
using std::endl;
police::police(){
name = "";
money = -1;
respect = -1;
}
police::police(string n, double m, int r) {
name = n ;
money = m ;
respect = r ;
}
police& police::caught(thief& x) {
money += 100;
respect++;
x.becaught();
return *this;
}
void police::display() {
cout << name << " " << money << " " << "Respect :" << respect << endl;
}