a12704538681 2021-06-18 20:22 采纳率: 50%
浏览 27
已结题

 这个问题怎么解决,求解

#include<iostream>
#include<string>
using namespace std;

class Employee
{
public:
	Employee(string na,int bm);
	string getname();
	virtual float getSalary(int month)=0;
protected:
	string name;
	int brith_month;

};


Employee::Employee(string na,int bm):name(na),birth_month(bm){}
string Employee::getname(){return name;}

int main()
{
	return 0;
}

Eerror C2614: 'Employee' : illegal member initialization: 'birth_month' is not a base or member
 这个问题怎么解决

  • 写回答

1条回答 默认 最新

  • qzjhjxj 2021-06-18 20:43
    关注

    问题见注释处,brith_month  <===>  birth_month

    #include<iostream>
    #include<string>
    using namespace std;
    
    class Employee
    {
    public:
    	Employee(string na,int bm);
    	string getname();
    	virtual float getSalary(int month)=0;
    protected:
    	string name;
    	int brith_month;
    };
    Employee::Employee(string na,int bm):name(na),brith_month(bm){}//birth_month(bm){}
    string Employee::getname(){return name;}
    int main()
    {
        
    	return 0;
    }
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 9月25日
  • 已采纳回答 9月17日