2017-04-25 100 views
0

我已经搜索一吨的线程,并且不能找到解决该错误。它发生在线路8错误预期构造,析构函数,或类型之前转换“(”令牌

的BranchStaff.cpp文件是如如下。它作为另一个类父类。

#include "BranchStaff.h" 
#include <iostream> 
#include <string> 
#include <cstdlib> 

using namespace std; 

BranchStaff::BranchStaff(userIDIn, passwordIn) 
:userID(userIDIn), password(passwordIn) 
{ 
menuChoice = 0; 
over = false; 
while (!over) { 
cout << "=======================================================" << endl; 
cout << "|  Teller Terminal System - Branch Staff   |" << endl; 
cout << "=======================================================" << endl; 
cout << "1) Client and Account Management" << endl; 
cout << "2) Change password" << endl; 
cout << "3) Exit" 
cout << "\tPlease choose an option: "; 
cin >> menuChoice; 
while (menuChoice != 3 && menuChoice != 2 && menuChoice != 1) { 
     cout << "\tPlease enter a valid option: " << endl; 
     cin >> menuChoice; 
} 
switch (menuChoice) { 
case 1: 
    clientManagement() 
    break; 
case 2: 
    passwordChange() 
    break; 
case 3: 
    exit(); 
} 
} 
} 

void BranchStaff::changePassword() { 

} 

void BranchStaff::clientManagement() { 

} 

.h文件是如下

#ifndef BRANCHSTAFF_H 
#define BRANCHSTAFF_H 
#include <string> 
#include <iostream> 

using namespace std; 

class BranchStaff 
{ 
public: 
    BranchStaff(); 
    BranchStaff(string userIDIn, string passwordIn); 

protected: 
    void clientManagement(); 
    void changePassword(); 

private: 
    string userID; 
    string password; 
    int menuChoice; 
    bool over; 
}; 

#endif // BRANCHSTAFF_H 

回答

0
BranchStaff::BranchStaff(string userIDIn, string passwordIn) 
0

Possibl由于在实施中不包括数据类型。尝试

BranchStaff::BranchStaff(string userIDIn, string passwordIn) 

我也建议引用的字符串传递使用它们在初始化列表应该复制它们。

BranchStaff::BranchStaff(const string& userIDIn, const string& passwordIn) 
+0

这很容易解决了这个问题。不能相信这是如此基本的东西。感谢您的帮助。 –

相关问题