简体   繁体   中英

expected primary-expression before ' '

So I have a class and a derived class. Both need to have constructors but the problem is I get errors for the derived class' constructor.

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 ;
}

In constructor 'Property::Property(int, std::string, SpaceType, std::string, int, int, PropertyCategory)':|

error: expected primary-expression before 'int'|

error: expected primary-expression before 'name'|

error: expected primary-expression before 'type'|

error: expected primary-expression before 'actionText'|

Just call superclass constructor with parameters:

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();
}

}
;

help me with this pls

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM