第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

error C2659: “=”: 作為左操作數(shù) ?

//Person.h

#ifndef PERSON_H
#define PERSON_H

#include <string>
using namespace std;

class Person
{
public:
?? ?Person(string name);
?? ?virtual void work()=0;//純虛函數(shù)
?? ?virtual ~Person(){}
private:
?? ?string m_strName;
};

#endif

//Worker.h

#ifndef WORKER_H
#define WOEKER_H

#include "Person.h"
class Worker:public Person
{
public:
?? ?Worker(string name,int age);
?? ?//virtual void work();
private:
?? ?int m_iAge();
};

#endif

//Worker.cpp

#include <iostream>
#include "Worker.h"
using namespace std;

Worker::Worker(string name,int age):Person(name)
{
?? ?m_iAge = age;//錯誤1
}

//void Worker::work()
//{
//?? ?cout<<"work()"<<endl;
//}


錯誤?? ?1?? ?error C2659: “=”: 作為左操作數(shù)?? ?c:\users\administrator\documents\visual studio 2012\projects\consoleapplication39\consoleapplication39\worker.cpp?? ?7?? ?1?? ?ConsoleApplication39


正在回答

1 回答

private:
?? ?int m_iAge();

你定義的是一個成員函數(shù);調(diào)用的時候卻當(dāng)成成員變量使用。

應(yīng)該把那個括號去掉就可以了?!?/p>

private:
?? ?int m_iAge;

2 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕粉3168680 提問者

謝謝!
2017-04-07 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
C++遠(yuǎn)征之多態(tài)篇
  • 參與學(xué)習(xí)       66225    人
  • 解答問題       329    個

本教程將帶領(lǐng)大家體會面向?qū)ο笕筇匦灾械亩鄳B(tài)特性

進(jìn)入課程

error C2659: “=”: 作為左操作數(shù) ?

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號