+ 2

Why this program does not work on the 7 line have brackets?

#include <iostream> using namespace std; class bankAccount { public: void bankAccount() { ^ | | int pass; cin >> pass; if(pass == 22547) { cout << "Hi !" << endl; } else if(pass != 22547) { cout << "Error" << endl; } } }; int main() { bankAccount test; test.bankAccount(); return 0; }

15th Aug 2017, 8:39 PM
BuyDen
BuyDen - avatar
1 Odpowiedź
+ 4
rename the method, a method can't have the class name (conflict with constructor)
15th Aug 2017, 8:50 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar