我正在创建一个名为SelectionPage的类。基本上是一组菜单。编译器如何在类构造函数之前请求初始化程序?
然而,当我编译代码,编译器给了我以下错误:
g++ C_Main.cpp C_HomePage.cpp C_SelectionPage.cpp C_MemberManagement.cpp -o Project
C_SelectionPage.cpp:9:104: error: expected initializer before ‘SelectionPage’
make: *** [Project] Error 1
这里是C_SelectionPage.cpp的前几行:
#include "H_SelectionPage.h"
//Constructor for the SelectionPage class
//It assigns "managing" which decides if the user
//is a manager or not.
SelectionPage::SelectionPage(
int newPoints,
string newManager,
string newLoginName,
string MemberFile)
SelectionPage(
int newPoints,
string newManager,
string newLoginName,
string MemberFile)
{
points = newPoints;
manager = newManager;
loginName = newLoginName;
flatMemberList.clear();
//Create Object Governing Flat Members.
memberList = MemberManagement temp(MemberFile);
}
这里是宣言的头文件中的构造函数:
SelectionPage(
int newPoints,
string newManager,
string newLoginName,
string MemberFile);
有人请向我解释为什么ia m出现错误?
在此先感谢。
这是**真的**你在C++文件中有什么? 'SelectionPage :: SelectionPage(int newPoints,string newManager,string newLoginName,string MemberFile)** SelectionPage **(int newPoints,string newManager,string newLoginName,string MemberFile){? – Mat