I\'m using C++ to build a credit card simulator. My code is already completed, h
ID: 3860965 • Letter: I
Question
I'm using C++ to build a credit card simulator. My code is already completed, however I am getting three error messages on my CreditCard.h file. The three error messages are
error C2327: 'CreditCard::lim' : is not a type name, static, or enumerator
error C2065: 'lim' : undeclared identifier
error C2864: 'CreditCard::bala' : only static const integral data members can be initialized within a class
Here is the link to my project file. I am using Microsoft Visual Studio 2012 to write this code, and am absolutely stuck on how to fix the problem. Please fix the errors so that the program compiles and runs correctly. You can simply post the code snippet that you changed if you prefer.
https://1drv.ms/u/s!AjLswKvo9tl3hCzsNBkY1IVPmgjN
Explanation / Answer
Here:
double bala=lim; //You can't Initialize a varable like that in class To intialize a varable use constructor or create a function to intialize it
But in this case you already give body of void constuctor CreditCard(); so what I edit is this:
CreditCard::CreditCard(void)
{
bala=lim; // I intialize it in creditcard.cpp
}
Comment if you have any problem in this and please give me thumbs up :)
I hope this help