From bfa3196b62fa92d5d2b204a2f49a23141848c932 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sat, 8 Feb 2025 11:09:09 -0500 Subject: [PATCH] account: split class logic out and have it building Signed-off-by: Vincent Batts --- account.cpp | 7 ++++--- account.h | 6 ++---- main.cpp | 29 +++++++++++++++++++++++++++++ meson.build | 2 +- 4 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 main.cpp diff --git a/account.cpp b/account.cpp index c30c977..5fd2a26 100644 --- a/account.cpp +++ b/account.cpp @@ -6,7 +6,8 @@ using namespace std; #include "account.h" -int main(int argc, char* argv[]) { - Account account(0.0); - return EXIT_SUCCESS; +Account::Account ( double initial_balance ) : balance(initial_balance) { +} + +Account::~Account () { } diff --git a/account.h b/account.h index bfb2bb5..2fb093f 100644 --- a/account.h +++ b/account.h @@ -12,10 +12,8 @@ class Account /* ==================== LIFECYCLE ======================================= */ //Account (); /* constructor */ //Account ( const Account &other ); /* copy constructor */ - Account ( double initial_balance ) : balance(initial_balance) { - } - ~Account () { /* destructor */ - } + Account ( double initial_balance ); + ~Account (); /* destructor */ /* ==================== ACCESSORS ======================================= */ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..73caee6 --- /dev/null +++ b/main.cpp @@ -0,0 +1,29 @@ +/* + * ===================================================================================== + * + * Filename: main.cpp + * + * Description: + * + * Version: 1.0 + * Created: 02/08/2025 11:05:02 AM + * Revision: none + * Compiler: gcc + * + * Author: YOUR NAME (), + * Organization: + * + * ===================================================================================== + */ +#include +#include +#include + +#include "account.h" + +using namespace std; + +int main(int argc, char* argv[]) { + Account account(0.0); + return EXIT_SUCCESS; +} diff --git a/meson.build b/meson.build index e5a735f..27c1cb6 100644 --- a/meson.build +++ b/meson.build @@ -8,5 +8,5 @@ a = run_command('date', check: true) read_exe = executable('read', 'read.c', link_language : 'c',) readpp_exe = executable('read++', 'read++.cpp') -account_sources = ['account.cpp', 'account.h'] +account_sources = ['main.cpp', 'account.cpp', 'account.h'] account_exe = executable('account', account_sources)