错误期望构造函数,析构函数或类型转换之前的'('令牌

时间:2017-04-25 03:22:07

标签: c++

我搜索了大量的线程,无法找到解决此错误的方法。它发生在第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

2 个答案:

答案 0 :(得分:0)

BranchStaff::BranchStaff(string userIDIn, string passwordIn)

答案 1 :(得分:0)

可能由于在实现中不包括数据类型。尝试

BranchStaff::BranchStaff(string userIDIn, string passwordIn)

我还建议通过引用传递字符串,因为在初始化列表中使用它们应该复制它们。

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