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 =)

# 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 
}

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:

void account::withdraw(int amount)
void account::deposit(int amount)
int account::balance(void)

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:

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

But I don't see the line

class account

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.