[英]expected primary-expression before ' '
所以我有一個類和一個派生類。 兩者都需要有構造函數,但問題是派生類的構造函數出現錯誤。
class Property : public Space
Property::Property(int id, string name, SpaceType type, string actionText, int buyCost, int upgradeCost, PropertyCategory category): Space(int id, string name, SpaceType type, string actionText)
{
this->buyCost = buyCost ;
this->upgradeCost = upgradeCost ;
this->category = category ;
numberOfHouses = 0 ;
}
在構造函數中'Property::Property(int, std::string, SpaceType, std::string, int, int, PropertyCategory)':|
錯誤:'int' 之前的預期主表達式|
錯誤:'name' 之前的預期主表達式|
錯誤:'type' 之前的預期主表達式|
錯誤:'actionText' 之前的預期主要表達式|
只需使用參數調用超類構造函數:
Property::Property(int id, string name, SpaceType type, string actionText, int
buyCost, int upgradeCost, PropertyCategory category): Space(id, name, type, actionText)
{
this->buyCost = buyCost ;
this->upgradeCost = upgradeCost ;
this->category = category ;
numberOfHouses = 0 ;
}
#include <iostream>
using namespace std;
class loginManager
{
public:
string IDNumberattempt;
string Yournameattempt;
loginManager()
{
string accessGranted=0;
}
void login()
{
cout<<"________________________________________________________________________________\n";
cout<<" ///////////////BATANG PASAWAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\""\n";
cout<<"________________________________________________________________________________\n";
cout<<" WELCOME TO BACHELOR OF SCIENCE IN INDUSTRIAL AUTOMATION & MECHATRONICS\n\n";
cout<<" Mindanao State University - Iligan Institute of Technology\n\n";
cout<<"\n S.Y. 2018-2019";
cout<<"\n\n\n";
cout<<" PROJECT CREATED BY STUDENT OF BSIAM\n\n";
cout<<"\n\n";
cout<<" SIGN IN FOR ATTENDACE:\n\n";
string IDnumber;
cout<<"Please Input your IDnumber and Name\n";
cout<<"IDnumber:";
cin>>IDNumberattempt;
if(IDNumberattempt==IDnumber)
{
string Name;
cout<<"Name:";
cin>>Yournameattempt;
if(Yournameattempt==Name)
{
cout<<"hey You're Logged In.";
}
}
private:
string Name = "Admin"
string ID Number = "2018-5844";
bool accessGranted;
};
int main()
{
loginManager loginManagerObj;
loginManagerObj.login();
}
}
;
請幫助我
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.