kleinere Änderungen

This commit is contained in:
Johannes Theiner 2018-12-10 18:50:33 +01:00
parent 59c400a3cb
commit 8df909d8ff
5 changed files with 12 additions and 13 deletions

View File

@ -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
...

View File

@ -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;
}

View File

@ -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();
};

View File

@ -3,7 +3,6 @@
#include "Cash.h"
Cash::Cash(int value, Currency currency) : Money(value, currency) {
}

View File

@ -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;
});
}