10_PITF: Wieder auf Anfang

This commit is contained in:
Johannes Theiner 2019-01-02 15:29:11 +01:00
parent dd71612348
commit 5c46cc3d66
21 changed files with 141 additions and 251 deletions

View File

@ -100,27 +100,11 @@ int main(int argc, char **argv) {
} }
} }
/* for (Bank *bank : banks) {
* Schmeißt nen SIGSERV/SEGFAULT for (BankAccount *bankAccount : bank->getAccounts()) {
* std::for_each(banks.begin(), banks.end(), [cashFactory] (Bank * bank) { delete(bankAccount);
std::for_each(bank->getAccounts().begin(), bank->getAccounts().end(), [cashFactory] (BankAccount * bankAccount) { }
std::cout << *bankAccount << std::endl; delete(bank);
for (int i = 0; i < 10000; ++i) { }
int rnd = distribution(generator);
Bill * bill = cashFactory->printBill(rnd, CurrencyValue::USD);
Coin * coin = cashFactory->printCoin(rnd, CurrencyValue::USD);
if(bill != nullptr) {
*bankAccount + bill;
}
if(coin != nullptr) {
*bankAccount + coin;
}
delete bill;
delete coin;
}
std::cout << *bankAccount << std::endl;
});
});
*/
} }

View File

@ -1 +1 @@
add_executable(10_PITF_Testat Testat/main.cpp Testat/Money.cpp Testat/Money.h Testat/Currency.h Testat/BankAccount.cpp Testat/BankAccount.h Testat/Cash.cpp Testat/Cash.h Testat/Currency.cpp Testat/Coin.cpp Testat/Coin.h Testat/Bill.cpp Testat/Bill.h Testat/CashFactory.h Testat/Person.cpp Testat/Person.h Testat/CashFactory.cpp Testat/Bank.cpp Testat/Bank.h Testat/HeapObject.h Testat/HeapObject.cpp) add_executable(10_PITF_Testat Testat/main.cpp Testat/HeapObject.h Testat/HeapObject.cpp Testat/Bank.cpp Testat/BankAccount.cpp Testat/Money.cpp Testat/Coin.cpp Testat/Cash.cpp Testat/Currency.cpp Testat/CashFactory.cpp Testat/Person.cpp Testat/Bill.cpp)

View File

@ -3,24 +3,15 @@
#include "Bank.h" #include "Bank.h"
Bank::Bank(std::string const& name) : name(name) { Bank::Bank(std::string name) : name(std::move(name)) {
} }
Bank::Bank(Bank* bank) : name(bank->name) { void Bank::addAccount(BankAccount * account) {
money.swap(bank->money); accounts.insert(account);
accounts.swap(bank->accounts);
} }
void Bank::addAccount(std::shared_ptr<BankAccount> account) { std::set<BankAccount *> Bank::getAccounts() {
this->accounts.insert(std::move(account));
}
void Bank::addMoney(std::shared_ptr<Money> money) {
this->money.insert(std::move(money));
}
std::set<std::shared_ptr<BankAccount>> Bank::getAccounts() {
return accounts; return accounts;
} }
@ -28,4 +19,7 @@ std::string Bank::getName() {
return name; return name;
} }
void Bank::addMoney(Money * money) {
this->money.insert(money);
}

View File

@ -3,18 +3,18 @@
#include "BankAccount.h" #include "BankAccount.h"
#include "HeapObject.h"
class Bank { class Bank : public HeapObject{
private: private:
std::string name; std::string name;
std::set<std::shared_ptr<BankAccount>> accounts; std::set<BankAccount *> accounts;
std::set<std::shared_ptr<Money>> money; std::set<Money *> money;
public: public:
explicit Bank(std::string const& name); explicit Bank(std::string name);
explicit Bank(Bank* bank); void addAccount(BankAccount * account);
void addAccount(std::shared_ptr<BankAccount> account); void addMoney(Money * money);
void addMoney(std::shared_ptr<Money> money); std::set<BankAccount *> getAccounts();
std::set<std::shared_ptr<BankAccount>> getAccounts();
std::string getName(); std::string getName();
}; };

View File

@ -1,59 +1,34 @@
#include <utility>
#include <memory>
#include <iostream>
#include "BankAccount.h" #include "BankAccount.h"
#include "CashFactory.h" #include "CashFactory.h"
BankAccount::BankAccount(std::shared_ptr<Person> const& owner, std::string const& name) : name(name), owner(std::move(owner)) { BankAccount::BankAccount(Person * owner, std::string name) : name(std::move(name)) {
this->owner = owner;
} }
BankAccount::BankAccount(BankAccount *bankAccount) : name(bankAccount->name) { BankAccount * BankAccount::operator+(Money * money) {
money.swap(bankAccount->money);
owner.swap(bankAccount->owner); BankAccount::money = new Money(money->getValue() + getMoney().getValue());
return this;
} }
BankAccount::BankAccount(BankAccount &bankAccount) : name(bankAccount.name) { Money * BankAccount::operator-(int value) {
money.swap(bankAccount.money);
owner.swap(bankAccount.owner);
}
std::shared_ptr<BankAccount> BankAccount::operator+(std::shared_ptr<Bill> money) {
this->money->setValue(this->money->getValue() + money->getValue());
return std::make_shared<BankAccount>(*this);
}
std::shared_ptr<BankAccount> BankAccount::operator+(std::shared_ptr<Coin> money) {
std::shared_ptr<Money> ptr = std::make_shared<Money>(new Money(money->getValue() + this->money->getValue(), money->getCurrency()));
BankAccount::money = ptr;
return std::make_shared<BankAccount>(*this);
}
std::shared_ptr<Coin> BankAccount::operator-(int value) {
auto * cashFactory = new CashFactory(); auto * cashFactory = new CashFactory();
return cashFactory->printCoin(value, CurrencyValue::USD); return cashFactory->printCoin(value, CurrencyValue::USD);
} }
bool BankAccount::operator<(BankAccount * bankAccount) {
bool BankAccount::operator<(std::shared_ptr<BankAccount> bankAccount) { return money.getValue() < bankAccount->money.getValue();
return this->money->getValue() < bankAccount->money->getValue();
} }
std::string BankAccount::getName() { std::string BankAccount::getName() {
return name; return name;
} }
std::shared_ptr<Money> BankAccount::getMoney() { Money BankAccount::getMoney() {
return money; return money;
} }
std::shared_ptr<Person> BankAccount::getOwner() { Person *BankAccount::getOwner() {
return owner; return owner;
} }

View File

@ -1,27 +1,25 @@
#ifndef C_C_BANKACCOUNTS_H #ifndef C_C_BANKACCOUNTS_H
#define C_C_BANKACCOUNTS_H #define C_C_BANKACCOUNTS_H
#include <unordered_map>
#include "Money.h" #include "Money.h"
#include "Cash.h"
#include "Person.h" #include "Person.h"
#include "Coin.h"
#include "Bill.h"
class BankAccount { class BankAccount {
private: private:
std::string name; std::string name;
std::shared_ptr<Person> owner; Person * owner;
std::shared_ptr<Money> money; Money money;
public: public:
explicit BankAccount(std::shared_ptr<Person> const& owner, std::string const& name); explicit BankAccount(Person * owner, std::string name);
explicit BankAccount(BankAccount *bankAccount); BankAccount* operator+(Money * money);
BankAccount(BankAccount& bankAccount); Money* operator-(int value);
std::shared_ptr<BankAccount> operator+(std::shared_ptr<Coin> money); bool operator<(BankAccount * bankAccount);
std::shared_ptr<BankAccount> operator+(std::shared_ptr<Bill> money);
std::shared_ptr<Coin> operator-(int value);
bool operator<(std::shared_ptr<BankAccount> bankAccount);
std::string getName(); std::string getName();
std::shared_ptr<Person> getOwner(); Person * getOwner();
std::shared_ptr<Money> getMoney(); Money getMoney();
}; };

View File

@ -6,14 +6,6 @@ Bill::Bill(int value, Currency currency, std::string serial) : Cash(value, curre
} }
Bill::Bill(Bill *bill) : Cash(bill->getValue(), bill->getCurrency()), serial(bill->getSerial()){
}
Currency Bill::getCurrency() {
return Money::getCurrency();
}
int Bill::getValue() { int Bill::getValue() {
return Money::getValue() * 10; return Money::getValue() * 10;
} }

View File

@ -9,9 +9,7 @@ private:
std::string serial; std::string serial;
public: public:
Bill(int value, Currency currency, std::string serial); Bill(int value, Currency currency, std::string serial);
explicit Bill(Bill *bill);
std::string getSerial(); std::string getSerial();
Currency getCurrency();
int getValue(); int getValue();
}; };

View File

@ -1,10 +1,11 @@
#ifndef C_C_CASH_H #ifndef C_C_CASH_H
#define C_C_CASH_H #define C_C_CASH_H
#include <string>
#include "Money.h" #include "Money.h"
#include "HeapObject.h" #include "HeapObject.h"
class Cash : public HeapObject, public Money{ class Cash : public Money, public HeapObject{
private: private:
public: public:
Cash(int value, Currency currency); Cash(int value, Currency currency);

View File

@ -1,5 +1,4 @@
#include <algorithm> #include <algorithm>
#include <iostream>
#include "CashFactory.h" #include "CashFactory.h"
int allowedBills[5] = {100, 50, 20, 10, 5}; int allowedBills[5] = {100, 50, 20, 10, 5};
@ -7,8 +6,7 @@ int allowedCoins[8] = {1, 2, 5, 10, 20, 50, 100, 200};
std::vector<std::string> usedSerials; std::vector<std::string> usedSerials;
std::shared_ptr<Bill> CashFactory::printBill(int value, Currency currency) { Bill * CashFactory::printBill(int value, Currency currency) {
std::cout << "Test" << std::endl;
auto * iter = std::find(std::begin(allowedBills), std::end(allowedBills), value); auto * iter = std::find(std::begin(allowedBills), std::end(allowedBills), value);
if(iter == std::end(allowedBills)) { if(iter == std::end(allowedBills)) {
return nullptr; return nullptr;
@ -18,17 +16,15 @@ std::shared_ptr<Bill> CashFactory::printBill(int value, Currency currency) {
serial = randomString(15); serial = randomString(15);
} }
usedSerials.push_back(serial); usedSerials.push_back(serial);
return new Bill(value, currency, serial);
std::cout << "Test2" << std::endl;
return std::make_shared<Bill>(new Bill(value, currency, serial));
} }
} }
std::shared_ptr<Coin> CashFactory::printCoin(int value, Currency currency) { Coin * CashFactory::printCoin(int value, Currency currency) {
auto * iter = std::find(std::begin(allowedCoins), std::end(allowedCoins), value); auto * iter = std::find(std::begin(allowedCoins), std::end(allowedCoins), value);
if(iter == std::end(allowedCoins)) { if(iter == std::end(allowedCoins)) {
return nullptr; return nullptr;
}else return std::make_shared<Coin>(new Coin(value, currency)); }else return new Coin(value, currency);
} }
std::string CashFactory::randomString(size_t length) { std::string CashFactory::randomString(size_t length) {

View File

@ -3,8 +3,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory>
#include "Bill.h" #include "Bill.h"
#include "Coin.h" #include "Coin.h"
@ -12,8 +10,8 @@ class CashFactory {
private: private:
std::string randomString(size_t length); std::string randomString(size_t length);
public: public:
std::shared_ptr<Bill> printBill(int value, Currency currency); Bill * printBill(int value, Currency currency);
std::shared_ptr<Coin> printCoin(int value, Currency currency); Coin * printCoin(int value, Currency currency);
}; };
#endif #endif

View File

@ -4,14 +4,6 @@ Coin::Coin(int value, Currency currency) : Cash(value, currency) {
} }
Coin::Coin(Coin *coin) : Cash(coin->getValue(), coin->getCurrency()) {
}
Currency Coin::getCurrency() {
return Money::getCurrency();
}
int Coin::getValue() { int Coin::getValue() {
return Money::getValue(); return Money::getValue();
} }

View File

@ -8,9 +8,7 @@ class Coin : public Cash{
private: private:
public: public:
Coin(int value, Currency currency); Coin(int value, Currency currency);
explicit Coin(Coin *coin); int getValue() override;
Currency getCurrency();
int getValue();
}; };
#endif #endif

View File

@ -4,7 +4,7 @@
Currency::Currency(CurrencyValue value) : value(value) { Currency::Currency(CurrencyValue value) : value(value) {
} }
bool Currency::operator==(Currency currency) { bool Currency::operator==(Currency &currency) {
return value == currency.value; return value == currency.value;
} }

View File

@ -14,7 +14,7 @@ private:
CurrencyValue value; CurrencyValue value;
public: public:
Currency(CurrencyValue value); Currency(CurrencyValue value);
bool operator==(Currency currency); bool operator==(Currency &currency);
Currency& operator=(Currency currency); Currency& operator=(Currency currency);
CurrencyValue getValue(); CurrencyValue getValue();

View File

@ -1,5 +1,6 @@
#include <cstdlib> #include <cstdlib>
#include <cassert> #include <cassert>
#include <iostream>
#include "HeapObject.h" #include "HeapObject.h"
int HeapObject::ctorCount = 0; int HeapObject::ctorCount = 0;
@ -21,6 +22,7 @@ HeapObject::~HeapObject(){
bool HeapObject::assertionsHold(){ bool HeapObject::assertionsHold(){
assert(ctorCount == newCount); // all objects have been allocated on heap assert(ctorCount == newCount); // all objects have been allocated on heap
//assert(ctorCount == dtorCount); // all objects have been deleted std::cout << ctorCount << " == " << dtorCount << std::endl;
assert(ctorCount == dtorCount); // all objects have been deleted
return true; return true;
} }

View File

@ -1,61 +1,45 @@
#include <iostream>
#include "Money.h" #include "Money.h"
Money::Money(int value, Currency currency) : value(value), currency(currency) { Money::Money(int value, Currency currency) : value(value), currency(currency) {
} }
Money::Money(Money *money) : value(money->value), currency(money->currency) { Money& Money::operator=(Money money) {
std::cout << "Test2" << std::endl;
}
std::shared_ptr<Money> Money::operator=(Money money) {
value = money.getValue(); value = money.getValue();
currency = money.getCurrency(); currency = money.getCurrency();
return std::make_shared<Money>(*this); return *this;
} }
std::shared_ptr<Money> Money::operator+(Money &a) { Money &Money::operator=(Money *money) {
value = money->getValue();
currency = money->getCurrency();
return *this;
}
Money Money::operator+(Money &a) {
if(currency == a.currency) { if(currency == a.currency) {
return std::make_shared<Money>(Money(value + a.value, CurrencyValue::USD)); return Money(value + a.value);
}else return std::make_shared<Money>(Money(-1, Currency(CurrencyValue::USD))); }else return Money(-1, Currency(CurrencyValue::USD));
} }
std::shared_ptr<Money> Money::operator+(Bill &a) { Money Money::operator-(Money &a) {
if(currency == a.getCurrency()) {
return std::make_shared<Money>(Money(value + a.getValue(), CurrencyValue::USD));
}else return std::make_shared<Money>(Money(-1, Currency(CurrencyValue::USD)));
}
std::shared_ptr<Money> Money::operator+(Coin &a) {
if(currency == a.getCurrency()) {
return std::make_shared<Money>(Money(value + a.getValue(), CurrencyValue::USD));
}else return std::make_shared<Money>(Money(-1, Currency(CurrencyValue::USD)));
}
std::shared_ptr<Money> Money::operator-(Money &a) {
if(currency == a.currency) { if(currency == a.currency) {
return std::make_unique<Money>(Money(value - a.value, CurrencyValue::USD)); return Money(value - a.value);
}else return std::make_unique<Money>(Money(-1, Currency(CurrencyValue::USD))); }else return Money(-1, Currency(CurrencyValue::USD));
} }
const std::shared_ptr<Money> Money::operator++(int) { const Money Money::operator++(int) {
value++; return Money(value++);
return std::make_unique<Money>(*this);
} }
const std::shared_ptr<Money> Money::operator--(int) { const Money Money::operator--(int) {
value--; return Money(value--);
return std::make_unique<Money>(*this);
} }
int Money::getValue() { int Money::getValue() {
return value; return value;
} }
void Money::setValue(int value) {
this->value = value;
}
Currency Money::getCurrency() { Currency Money::getCurrency() {
return currency; return currency;
} }

View File

@ -1,30 +1,23 @@
#ifndef C_C_MONEY_H #ifndef C_C_MONEY_H
#define C_C_MONEY_H #define C_C_MONEY_H
#include <memory>
#include "Currency.h" #include "Currency.h"
#include "Bill.h"
#include "Coin.h"
class Money { class Money {
private: private:
int value; int value;
Currency currency; Currency currency;
public: public:
explicit Money(int value, Currency currency); explicit Money(int value = 0, Currency currency = CurrencyValue::USD);
explicit Money(Money* money); Money& operator=(Money money);
std::shared_ptr<Money> operator=(Money money); Money& operator=(Money * money);
std::shared_ptr<Money> operator+(Money &a); Money operator+(Money &a);
std::shared_ptr<Money> operator+(Bill &a); Money operator-(Money &a);
std::shared_ptr<Money> operator+(Coin &a); const Money operator++(int);
std::shared_ptr<Money> operator-(Money &a); const Money operator--(int);
const std::shared_ptr<Money> operator++(int);
const std::shared_ptr<Money> operator--(int);
virtual int getValue(); virtual int getValue();
virtual void setValue(int value); Currency getCurrency();
virtual Currency getCurrency();
}; };
#endif #endif

View File

@ -2,14 +2,10 @@
#include "Person.h" #include "Person.h"
Person::Person(std::string const& name) : name(name) { Person::Person(std::string name) : name(std::move(name)){
} }
Person::Person(Person *person) : name(person->name) {
money.swap(person->money);
}
std::string Person::getName() { std::string Person::getName() {
return name; return name;
} }

View File

@ -3,17 +3,14 @@
#include <string> #include <string>
#include <memory>
#include "Money.h" #include "Money.h"
class Person { class Person {
private: private:
std::string name; std::string name;
std::vector<std::shared_ptr<Money>> money; std::vector<Money *> money;
public: public:
explicit Person(std::string const& name); explicit Person(std::string name);
explicit Person(Person* person);
std::string getName(); std::string getName();
}; };

View File

@ -1,11 +1,9 @@
#include <set>
#include <algorithm>
#include <iostream> #include <iostream>
#include <ctime> #include <set>
#include <random> #include <random>
#include "Currency.h" #include <ctime>
#include "BankAccount.h" #include "HeapObject.h"
#include "Bill.h"
#include "CashFactory.h" #include "CashFactory.h"
#include "Bank.h" #include "Bank.h"
@ -24,99 +22,93 @@ std::ostream &operator<<(std::ostream &os, Currency currency) {
return os; return os;
} }
std::ostream &operator<<(std::ostream &os, std::shared_ptr<Bill> const& bill) { std::ostream &operator<<(std::ostream &os, Bill bill) {
os << bill->getValue() << " " << bill->getCurrency() << " " << bill->getSerial(); os << bill.getValue() << " " << bill.getCurrency() << " " << bill.getSerial();
return os; return os;
} }
std::ostream &operator<<(std::ostream &os, std::shared_ptr<Coin> const& cash) { std::ostream &operator<<(std::ostream &os, Cash cash) {
os << cash->getValue() << " " << cash->getCurrency(); os << cash.getValue() << " " << cash.getCurrency();
return os; return os;
} }
std::ostream &operator<<(std::ostream &os, std::shared_ptr<Money> const& money) { std::ostream &operator<<(std::ostream &os, Money money) {
os << money->getValue() << " " << money->getCurrency(); os << money.getValue() << " " << money.getCurrency();
return os; return os;
} }
std::ostream &operator<<(std::ostream &os, std::shared_ptr<Person> const& person) { std::ostream &operator<<(std::ostream &os, Person *person) {
os << person->getName(); os << person->getName();
return os; return os;
} }
std::ostream &operator<<(std::ostream &os, BankAccount* bankAccount) { std::ostream &operator<<(std::ostream &os, BankAccount bankAccount) {
os << bankAccount->getName() << " " << ": " << bankAccount->getMoney(); os << bankAccount.getOwner() << " " << bankAccount.getName() << ": " << bankAccount.getMoney();
return os; return os;
} }
std::set<std::shared_ptr<Bank>> banks; std::set<Bank *> banks;
std::set<std::shared_ptr<Person>> owners;
CashFactory *cashFactory;
void setup() { void setup() {
//FIXME: das hier könnte das Problem sein
// http://www.cplusplus.com/forum/beginner/74320/
// Fehler könnte so gefunden werden:
// https://stackoverflow.com/a/6685693
std::shared_ptr<Bank> bank1 = std::make_shared<Bank>(new Bank("Bank 1"));
std::shared_ptr<Bank> bank2 = std::make_shared<Bank>(new Bank("Bank 2"));
std::shared_ptr<Bank> bank3 = std::make_shared<Bank>(new Bank("Bank 3"));
std::shared_ptr<Person> max = std::make_shared<Person>(new Person("Max Müller"));
std::shared_ptr<Person> marius = std::make_shared<Person>(new Person("Marius Müller"));
std::shared_ptr<Person> alex = std::make_shared<Person>(new Person("Alex Maier"));
owners.insert(max);
owners.insert(marius);
owners.insert(alex);
bank1->addAccount(std::make_shared<BankAccount>(new BankAccount(max, "Konto 1"))); Bank *bank1 = new Bank("Bank 1");
bank2->addAccount(std::make_shared<BankAccount>(new BankAccount(max, "Konto 2"))); Bank *bank2 = new Bank("Bank 2");
bank3->addAccount(std::make_shared<BankAccount>(new BankAccount(alex, "privat"))); Bank *bank3 = new Bank("Bank 3");
bank1->addAccount(std::make_shared<BankAccount>(new BankAccount(alex, "geschäftlich 1")));
bank2->addAccount(std::make_shared<BankAccount>(new BankAccount(alex, "geschäftlich 2")));
bank3->addAccount(std::make_shared<BankAccount>(new BankAccount(alex, "geschäftlich 3")));
bank1->addAccount(std::make_shared<BankAccount>(new BankAccount(marius, "Konto 1")));
bank2->addAccount(std::make_shared<BankAccount>(new BankAccount(marius, "Konto 2")));
bank3->addAccount(std::make_shared<BankAccount>(new BankAccount(marius, "Konto 3")));
banks.insert(std::move(bank1)); Person *max = new Person("Max Müller");
banks.insert(std::move(bank2)); Person *marius = new Person("Marius Müller");
banks.insert(std::move(bank3)); Person *alex = new Person("Alex Maier");
cashFactory = new CashFactory();
bank1->addAccount(new BankAccount(max, "Konto 1"));
bank2->addAccount(new BankAccount(max, "Konto 2"));
bank1->addAccount(new BankAccount(alex, "privat"));
bank3->addAccount(new BankAccount(alex, "geschäftlich 1"));
bank2->addAccount(new BankAccount(alex, "geschäftlich 2"));
bank1->addAccount(new BankAccount(alex, "geschäftlich 3"));
bank2->addAccount(new BankAccount(marius, "Konto 1"));
bank1->addAccount(new BankAccount(marius, "Konto 2"));
bank3->addAccount(new BankAccount(marius, "Konto 3"));
banks.insert(bank1);
banks.insert(bank2);
banks.insert(bank3);
} }
void simulate() { void simulate() {
for(auto && bank : banks) { auto *cashFactory = new CashFactory();
for (Bank *bank : banks) {
std::cout << std::endl; std::cout << std::endl;
std::cout << "======================== " << bank->getName() << " ========================" << std::endl; std::cout << "======================== " << bank->getName() << " ========================" << std::endl;
std::cout << std::endl; std::cout << std::endl;
for(auto && bankAccount : bank->getAccounts()) { for (BankAccount *bankAccount : bank->getAccounts()) {
for (int i = 0; i < 10000; ++i) { for (int i = 0; i < 10000; ++i) {
int rnd = distribution(generator); int rnd = distribution(generator);
std::cout << rnd << std::endl; Bill *bill = cashFactory->printBill(rnd, CurrencyValue::USD);
std::shared_ptr<Bill> bill = cashFactory->printBill(rnd, CurrencyValue::USD); Coin *coin = cashFactory->printCoin(rnd, CurrencyValue::USD);
std::shared_ptr<Coin> coin = cashFactory->printCoin(rnd, CurrencyValue::USD);
if (bill != nullptr) { if (bill != nullptr) {
bankAccount->operator+(bill); *bankAccount + bill;
} }
if (coin != nullptr) { if (coin != nullptr) {
//bankAccount->operator+(coin); *bankAccount + coin;
} }
//std::shared_ptr<Money> fee = bankAccount->operator-(10);
Money *fee = *bankAccount - 10;
} }
std::cout << "Test2" << std::endl; std::cout << *bankAccount << std::endl;
std::cout << bankAccount.get() << std::endl;
} }
} }
} }
void tearDown() { void tearDown() {
for (Bank *bank : banks) {
for (BankAccount *bankAccount : bank->getAccounts()) {
delete(bankAccount);
}
delete(bank);
}
} }