OOP HomeWork
This commit is contained in:
28
oop_hw4/hw123/police.cpp
Normal file
28
oop_hw4/hw123/police.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user