I'm having trouble initializing Objects while they're inside if else statements. I'm using Visual C++ 2008.
for instance:it would me this error:Code:class Account { Account(); Account(int = idnum, double creditLimit = 500.00); Account(double initBal, int idnum, double creditLimit = 100.00); public: somefunction(); }; if (a > 0 && b > 0) { Account customer(a,b); } else { Account customer; } customer.somefunction();i know that this means, i just don't know if there's a better way to do this.error C2065: 'customer' : undeclared identifier
error C2228: left of '.somefunction' must have class/struct/union
i'm required to take account information and initialize the object depending on the user's input.
i was thinking i'd use if else statements then create the object, but apparently that doesn't work.


Reply With Quote


Bookmarks