From 8df909d8ff31f623bd73fc3fb656240140d3f980 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 10 Dec 2018 18:50:33 +0100 Subject: [PATCH] =?UTF-8?q?kleinere=20=C3=84nderungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Doxyfile | 2 +- src/08_PTRN/Testat/BankAccount.cpp | 6 +++--- src/08_PTRN/Testat/BankAccount.h | 6 +++--- src/08_PTRN/Testat/Cash.cpp | 1 - src/08_PTRN/Testat/main.cpp | 10 +++++----- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Doxyfile b/Doxyfile index 0ba75e8..db8cd15 100644 --- a/Doxyfile +++ b/Doxyfile @@ -5,7 +5,7 @@ PROJECT_NAME = C/C++ PROJECT_NUMBER = OUTPUT_DIRECTORY = @CMAKE_CURRENT_SOURCE_DIR@/doc CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = Englisch +OUTPUT_LANGUAGE = English ... JAVADOC_AUTOBRIEF = YES ... diff --git a/src/08_PTRN/Testat/BankAccount.cpp b/src/08_PTRN/Testat/BankAccount.cpp index 9b5d1f2..a9cdef2 100644 --- a/src/08_PTRN/Testat/BankAccount.cpp +++ b/src/08_PTRN/Testat/BankAccount.cpp @@ -3,19 +3,19 @@ BankAccount::BankAccount(std::string name) : name(std::move(name)) {} Money* BankAccount::operator+(Money* money) { - Money *result = new Money(money->getValue() + getMoney().getValue()); + Money *result = new Money(money->getValue() + getMoney()->getValue()); return result; } bool BankAccount::operator<(BankAccount bankAccount) { - return money.getValue() < bankAccount.money.getValue(); + return money->getValue() < bankAccount.money->getValue(); } std::string BankAccount::getName() { return name; } -Money BankAccount::getMoney() { +Money * BankAccount::getMoney() { return money; } diff --git a/src/08_PTRN/Testat/BankAccount.h b/src/08_PTRN/Testat/BankAccount.h index 3d8998e..ef09c8e 100644 --- a/src/08_PTRN/Testat/BankAccount.h +++ b/src/08_PTRN/Testat/BankAccount.h @@ -9,13 +9,13 @@ class BankAccount { private: std::string name; - Money money; + Money * money; public: explicit BankAccount(std::string name); - Money* operator+(Money* money); + Money* operator+(Money * money); bool operator<(BankAccount bankAccount); std::string getName(); - Money getMoney(); + Money * getMoney(); }; diff --git a/src/08_PTRN/Testat/Cash.cpp b/src/08_PTRN/Testat/Cash.cpp index 94a65b6..51dd580 100644 --- a/src/08_PTRN/Testat/Cash.cpp +++ b/src/08_PTRN/Testat/Cash.cpp @@ -3,7 +3,6 @@ #include "Cash.h" - Cash::Cash(int value, Currency currency) : Money(value, currency) { } \ No newline at end of file diff --git a/src/08_PTRN/Testat/main.cpp b/src/08_PTRN/Testat/main.cpp index 46f4296..94dc0ab 100644 --- a/src/08_PTRN/Testat/main.cpp +++ b/src/08_PTRN/Testat/main.cpp @@ -37,7 +37,7 @@ std::ostream &operator<<(std::ostream &os, Currency currency) { } std::ostream &operator<<(std::ostream &os, Bill bill) { - os << bill.getValue() << " " << bill.getCurrency() << bill.getSerial(); + os << bill.getValue() << " " << bill.getCurrency() << " " << bill.getSerial(); return os; } @@ -56,8 +56,8 @@ std::ostream &operator<<(std::ostream &os, BankAccount bankAccount) { return os; } -Bill billPrinter(int value, Currency currency) { - return Bill(value, currency, random_string(5)); +Bill * billPrinter(int value, Currency currency) { + return new Bill(value, currency, random_string(10)); } @@ -71,9 +71,9 @@ int main(int argc, char **argv) { std::for_each(accounts.begin(), accounts.end(), [] (BankAccount* bankAccount){ int rnd = distribution(generator); - Bill bill = billPrinter(rnd, CurrencyValue::USD); + Bill * bill = billPrinter(rnd, CurrencyValue::USD); std::cout << bill << std::endl; - //Money* res = bankAccount + &bill; + //Money* res = bankAccount + bill; //std::cout << *res << std::endl; }); } \ No newline at end of file