10_PITF: weitere Fehlermeldungen behoben
This commit is contained in:
parent
5d1a567415
commit
65d5e297e7
|
@ -32,6 +32,3 @@ Money BankAccount::getMoney() {
|
|||
Person *BankAccount::getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ Bank::Bank(std::string name) : name(std::move(name)) {
|
|||
}
|
||||
|
||||
void Bank::addAccount(std::unique_ptr<BankAccount> account) {
|
||||
accounts.insert(account);
|
||||
accounts.insert(std::move(account));
|
||||
}
|
||||
|
||||
void Bank::addMoney(std::unique_ptr<Money> money) {
|
||||
this->money.insert(money);
|
||||
this->money.insert(std::move(money));
|
||||
}
|
||||
|
||||
std::set<std::unique_ptr<BankAccount>> Bank::getAccounts() {
|
||||
|
|
|
@ -9,6 +9,18 @@ BankAccount::BankAccount(std::shared_ptr<Person> owner, std::string name) : name
|
|||
|
||||
}
|
||||
|
||||
BankAccount::BankAccount(BankAccount *bankAccount) {
|
||||
this->name = bankAccount->name;
|
||||
money.swap(bankAccount->money);
|
||||
owner.swap(bankAccount->owner);
|
||||
}
|
||||
|
||||
BankAccount::BankAccount(BankAccount &bankAccount) {
|
||||
this->name = bankAccount.name;
|
||||
money.swap(bankAccount.money);
|
||||
owner.swap(bankAccount.owner);
|
||||
}
|
||||
|
||||
std::unique_ptr<BankAccount> BankAccount::operator+(Money* money) {
|
||||
std::unique_ptr<Money> ptr = std::make_unique<Money>(Money(money->getValue() + getMoney()->getValue(), money->getCurrency()));
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef C_C_BANKACCOUNTS_H
|
||||
#define C_C_BANKACCOUNTS_H
|
||||
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
#include "Money.h"
|
||||
|
@ -15,6 +14,8 @@ private:
|
|||
std::unique_ptr<Money> money;
|
||||
public:
|
||||
explicit BankAccount(std::shared_ptr<Person> owner, std::string name);
|
||||
explicit BankAccount(BankAccount *bankAccount);
|
||||
BankAccount(BankAccount& bankAccount);
|
||||
std::unique_ptr<BankAccount> operator+(Money* money);
|
||||
std::unique_ptr<Money> operator-(int value);
|
||||
bool operator<(std::unique_ptr<BankAccount> bankAccount);
|
||||
|
|
|
@ -6,6 +6,10 @@ Bill::Bill(int value, Currency currency, std::string serial) : Cash(value, curre
|
|||
|
||||
}
|
||||
|
||||
Bill::Bill(Bill *bill) : Cash(bill->getValue(), bill->getCurrency()), serial(bill->getSerial()){
|
||||
|
||||
}
|
||||
|
||||
int Bill::getValue() {
|
||||
return Money::getValue() * 10;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ private:
|
|||
std::string serial;
|
||||
public:
|
||||
Bill(int value, Currency currency, std::string serial);
|
||||
explicit Bill(Bill *bill);
|
||||
std::string getSerial();
|
||||
int getValue() override;
|
||||
};
|
||||
|
|
|
@ -4,6 +4,10 @@ Coin::Coin(int value, Currency currency) : Cash(value, currency) {
|
|||
|
||||
}
|
||||
|
||||
Coin::Coin(Coin *coin) : Cash(coin->getValue(), coin->getCurrency()) {
|
||||
|
||||
}
|
||||
|
||||
int Coin::getValue() {
|
||||
return Money::getValue();
|
||||
}
|
|
@ -8,6 +8,7 @@ class Coin : public Cash{
|
|||
private:
|
||||
public:
|
||||
Coin(int value, Currency currency);
|
||||
explicit Coin(Coin *coin);
|
||||
int getValue() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -68,15 +68,15 @@ void setup() {
|
|||
owners.insert(alex);
|
||||
|
||||
|
||||
bank1->addAccount(std::make_unique<BankAccount>(BankAccount(max, "Konto 1")));
|
||||
bank2->addAccount(std::make_unique<BankAccount>(BankAccount(max, "Konto 2")));
|
||||
bank3->addAccount(std::make_unique<BankAccount>(BankAccount(alex, "privat")));
|
||||
bank1->addAccount(std::make_unique<BankAccount>(BankAccount(alex, "geschäftlich 1")));
|
||||
bank2->addAccount(std::make_unique<BankAccount>(BankAccount(alex, "geschäftlich 2")));
|
||||
bank3->addAccount(std::make_unique<BankAccount>(BankAccount(alex, "geschäftlich 3")));
|
||||
bank1->addAccount(std::make_unique<BankAccount>(BankAccount(marius, "Konto 1")));
|
||||
bank2->addAccount(std::make_unique<BankAccount>(BankAccount(marius, "Konto 2")));
|
||||
bank3->addAccount(std::make_unique<BankAccount>(BankAccount(marius, "Konto 3")));
|
||||
bank1->addAccount(std::make_unique<BankAccount>(new BankAccount(max, "Konto 1")));
|
||||
bank2->addAccount(std::make_unique<BankAccount>(new BankAccount(max, "Konto 2")));
|
||||
bank3->addAccount(std::make_unique<BankAccount>(new BankAccount(alex, "privat")));
|
||||
bank1->addAccount(std::make_unique<BankAccount>(new BankAccount(alex, "geschäftlich 1")));
|
||||
bank2->addAccount(std::make_unique<BankAccount>(new BankAccount(alex, "geschäftlich 2")));
|
||||
bank3->addAccount(std::make_unique<BankAccount>(new BankAccount(alex, "geschäftlich 3")));
|
||||
bank1->addAccount(std::make_unique<BankAccount>(new BankAccount(marius, "Konto 1")));
|
||||
bank2->addAccount(std::make_unique<BankAccount>(new BankAccount(marius, "Konto 2")));
|
||||
bank3->addAccount(std::make_unique<BankAccount>(new BankAccount(marius, "Konto 3")));
|
||||
|
||||
banks.insert(std::move(bank1));
|
||||
banks.insert(std::move(bank2));
|
||||
|
|
Loading…
Reference in New Issue