From 7bba21b4abe3d083b4c340d78ff733d5e744794a Mon Sep 17 00:00:00 2001 From: JCMH1981 Date: Tue, 14 Jun 2022 20:43:15 -0500 Subject: [PATCH] Some corrections in exercise 3.12 --- Chapter-3/Account.cpp | 2 +- Chapter-3/Account.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Chapter-3/Account.cpp b/Chapter-3/Account.cpp index 77b9f0b..7b542f7 100644 --- a/Chapter-3/Account.cpp +++ b/Chapter-3/Account.cpp @@ -28,7 +28,7 @@ Account::Account(int initial_balance) if (initial_balance >= 0) { balance = initial_balance; - } + } else { balance = 0; diff --git a/Chapter-3/Account.h b/Chapter-3/Account.h index 8bf6662..e6149be 100644 --- a/Chapter-3/Account.h +++ b/Chapter-3/Account.h @@ -25,7 +25,7 @@ class Account private: int balance; public: - explicit Account(int balance); + explicit Account(int initial_balance); void credit(int amount); void debit(int amount); int getBalance() const; -- 2.11.4.GIT