Question
i have a compilation error. there is only one error. it saysundifined reference to 'Account::numberAccount ' //main.cpp #includeAccount.h #includeRegularAccount.h #includePremiumAccount.h int RegularAccount::numberRegularAccount=0; int PremiumAccount::numberPremiumAccount=0; double
i have a compilation error. there is only one error. it says"undifined reference to 'Account::numberAccount '
//main.cpp #include"Account.h" #include"RegularAccount.h" #include"PremiumAccount.h"
int RegularAccount::numberRegularAccount=0; int PremiumAccount::numberPremiumAccount=0; double PremiumAccount::MIN_BALANCE=1000;
int main() { const int MAX_NUM_REGULAR_ACCOUNTS=5; const int MAX_NUM_PREMIUM_ACCOUNTS=5; RegularAccount *regularAccountArray[MAX_NUM_REGULAR_ACCOUNTS]; PremiumAccount *premiumAccountArray[MAX_NUM_PREMIUM_ACCOUNTS];
double amount=-1; char *ownerName="something"; int accountNo=-1; int count=0; int index=-1; int ch=-1; while(ch!=8) { cout<<" .............................................................. "; cout<<" \t1) Create Regular Account."; cout<<" \t2) Create Premium Account."; cout<<" \t3) Deposit into Regular Account."; cout<<" \t4) Deposit into Premium Account."; cout<<" \t5) Withdraw from Regular Account."; cout<<" \t6) Withdraw from Premium Account."; cout<<" \t7) Display Information of all Accounts."; cout<<" \t8) QUIT"; cout<<" \t Enter Your Choice:"; cin>>ch; cout<<" .............................................................. "; switch(ch) { case 1: if(RegularAccount::getNumberRegularAccount()
break; case 4: index=-1; count=0; cout<<" \tEnter Account Number:"; cin>>accountNo; for(count=0;count } break; default: if(ch!=8) { cout<<" \tInvalid Choice...!!! "; } break; } } return 0; } ?----------------------------------------------------------------------------------------?---------------------------------------------------------------------------------------- ?----------------------------------------------------------------------------------------?---------------------------------------------------------------------------------------- //Account.h #ifndef ACCOUNT_H_INCLUDED #define ACCOUNT_H_INCLUDED #include class Account { private: int accountNumber; char *ownerName; protected: double balance; public: //static int numberAccount; static int numberAccount; Account(char *ownerName_,double balance_) { cout<<" Process in Account Class "; numberAccount++; accountNumber=balance_; strcpy(ownerName,ownerName_); accountNumber=numberAccount+1000; } virtual void withdraw(int amount) { this->balance-=amount; } void deposit(int amount) { this->balance+=amount; } int getAccountNumber() { return accountNumber; } int getBalance() { return balance; } char *getOwnerName() { return ownerName; } static int getnumberAccount() { return numberAccount; } virtual void print() { cout<<" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; cout<<" ---------------------------------------"; cout<<" \t\tACCOUNT DETAIL "; cout<<" ---------------------------------------"; cout<<" \tOwner:"< #endif // ACCOUNT_H_INCLUDED ?----------------------------------------------------------------------------------------?---------------------------------------------------------------------------------------- ?----------------------------------------------------------------------------------------?---------------------------------------------------------------------------------------- //RugularAccount.h #ifndef REGULARACCOUNT_H_INCLUDED #define REGULARACCOUNT_H_INCLUDED class RegularAccount:public Account { private: static int numberRegularAccount; public: //static int numberRegularAccount; RegularAccount(char *name,double amount):Account(name,amount) { numberRegularAccount++; } static int getNumberRegularAccount() { return numberRegularAccount; } void print() { cout<<" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; cout<<" ---------------------------------------"; cout<<" \t\tREGULAR ACCOUNT "; cout<<" ---------------------------------------"; cout<<" \tOwner:"< #endif // REGULARACCOUNT_H_INCLUDED ?----------------------------------------------------------------------------------------?---------------------------------------------------------------------------------------- ?----------------------------------------------------------------------------------------?---------------------------------------------------------------------------------------- //PremiumAccount.h #ifndef PREMIUMACCOUNT_H_INCLUDED #define PREMIUMACCOUNT_H_INCLUDED class PremiumAccount:public Account { private: static int numberPremiumAccount; static double MIN_BALANCE; public: //static int numberPremiumAccount; //static double MIN_BALANCE; PremiumAccount(char *name,double amount):Account(name,amount) { cout<<" Process in Premium Amount "; numberPremiumAccount++; } static int getNumberPremiumAccount() { return numberPremiumAccount; } void withdraw(int amount) { this->balance-=amount; } static double getMinBalance() { return MIN_BALANCE; } void print() { cout<<" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; cout<<" ---------------------------------------"; cout<<" \t\tPREMIUM ACCOUNT "; cout<<" ---------------------------------------"; cout<<" \tOwner:"< #endif // PREMIUMACCOUNT_H_INCLUDED ?---------------------------------------------------------------------------------------- ?----------------------------------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started