2017-04-25 61 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

這很容易解決了這個問題。不能相信這是如此基本的東西。感謝您的幫助。 –

相關問題