Undeclared variable
1 2 3 4 5 6 7 8 9 10
|
# include "header.h"
Saving :: Saving(char *N , double ir) : Account(Name,balance)
{
N = new char (strlen(Name)+1) ;
strcpy(N,Name) ;
interestRate = ir ;
if(interestRate == 0 )
interestRate = 5 ;
}
|
Help me! i do not know how to resolve this problem
1>d:\notes\computing pratical\oop assignment qns 4\oop assignment qns 4\saving.cpp(3) : error C2065: 'Name' : undeclared identifier
1>d:\notes\computing pratical\oop assignment qns 4\oop assignment qns 4\saving.cpp(5) : error C2065: 'Name' : undeclared identifier
Well, Name is not declared anywhere in that file. Post header.h as well.
okay will do
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
# include <ctime>
# include <iostream>
# include <cstdlib>
# include <iomanip>
using namespace std ;
class Account
{
protected:
int overdraft ;
float balance ;
char *name, password[9] ;
bool checkpassword() ;
public:
Account(char *N , float bal , int overdrft) ;
Account(char *N , float bal) ;
Account() ;
void Display() ;
void Deposit() ;
bool Withdraw() ;
bool To() ;
void Print() ;
void changepassword() ;
bool ATMwithdraw() ;
} ;
char menu() ;
class Saving : public Account
{
protected :
double interestRate ;
public :
Saving(char *N , double interestRate = 0) ; //default constructor
Saving() ;
~Saving() ;
};
|
Last edited on
Identifiers are case-sensitive. There's IS a variable called name
; there isn't, however, one called Name
.
I see... Thanks
Topic archived. No new replies allowed.