| | |
Bank Account class
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Solved Threads: 0
I am in the process of making a bank account class. I need to put a copy constructor to compare the checking and savings account. Also I need to learn how to insert the checking and savings accounts. I need an assignment operator to assign the checking account to the saving. Last but not least I need a overloaded operator to find the total of the saving and checking account. Any help appreciated whether you know one thing or two =)
C++ Syntax (Toggle Plain Text)
# include<iostream> void account::withdraw(int amount) void account::deposit(int amount) int account::balance(void) { public: static int transactions; Account(); Account(const Account &right);// copy cstr ~Account(); void withdraw(int);//Take from account void deposit(int);// Put into account int balance()const;/ / Read the balance Account& operator+(const Account &); Account& operator=(const Account &); virtual void account_update(int)=0; private: int bal; }; ostream &operator<<(ostream &, const Account&); { cout<<" 1. Deposit 2. Withdraw 3. Balance cin>>choice; switch(choice) { cout<<" break; case 1 : obj.deposit(); break; case 2: obj.withdraw(); break; case 3 :obj.balance(); break; } void deposit(int) { cout <<" Deposit "; cout<<" Amount being deposited "; cin>>more; balance+=more; } void withdraw(int) { cout<<"Withdrawal "; cout<<" Amount being withdrawed : "; cin>>amt; balance-=amt; } int balance()const; { cout<< " Account Balance" cout<<" Your Balance Is" balance= totl }
•
•
Join Date: Jan 2008
Posts: 3,817
Reputation:
Solved Threads: 501
I assume this didn't compile. I'm not clear what goes with what, whether there is supposed to be a header file or an implementation file, or one big file, or what. At the very top, you have this code:
Is this supposed to be part of the header? Part of the implementation? If it's part of the implementation, I don't see where it's implemented. If it's part of the header, I don't see any semicolons and I don't think you want the "account::" part in there.
I'm assuming this below is the account class header:
But I don't see the line
at the top, so I don't know. You also have a bunch of functions at the bottom that seem to be class functions, but I don't see any "account::" qualifier, so I'm not sure what your intent is. If this is all the code for your class, it has problems. If there is more, post it and tell us what goes with what.
C++ Syntax (Toggle Plain Text)
void account::withdraw(int amount) void account::deposit(int amount) int account::balance(void)
I'm assuming this below is the account class header:
C++ Syntax (Toggle Plain Text)
{ public: static int transactions; Account(); Account(const Account &right);// copy cstr ~Account(); void withdraw(int);//Take from account void deposit(int);// Put into account int balance()const;/ / Read the balance Account& operator+(const Account &); Account& operator=(const Account &); virtual void account_update(int)=0; private: int bal; };
C++ Syntax (Toggle Plain Text)
class account
![]() |
Similar Threads
- Help Needed With OOP Bank Account..VB.Net (VB.NET)
- Bank Account ===>Need help >.< Thk (C++)
- Bank Account Class (C++)
- Unable to view yahoo mail or online bank account etc (Viruses, Spyware and other Nasties)
- need to write a class schema asap (Computer Science)
- Bank account class (C++)
Other Threads in the C++ Forum
- Previous Thread: opening .txt file and sorting
- Next Thread: How to do this?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






