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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我是新手,想問一下C++構(gòu)造類時的錯誤

我是新手,想問一下C++構(gòu)造類時的錯誤

C++
對著天說晚安 2016-02-28 10:21:20
#include <iostream>#include "coordinate.h"using namespace std;class Line{public:? ?Line(int x1,int y1,int x2,int y2);? ?~Line();? ?void setA(int x,int y);? ?void setB(int x,int y);? ?void printinfo();private:? ?Coordinate m_coorA;? ?Coordinate m_coorB;};Line::Line(int x1,int y1,int x2,int y2):m_coorA(x1,y1),coorB(x2,y2){? ?cout<<"Line"<<endl;}Line::~Line(){? ? cout<<"~Line"<<endl;}void Line::setA(int x,int y){? ? m_coorA.setX(x);? ? m_coorA.setY(y);}void Line::setB(int x,int y){? ? m_coorB.setX(x);? ? m_coorB.setY(y);}void printinfo(){? ? cout<<"m_coorA.getX()"<<" "<<"m_coorA.getY()"<<endl;? ? cout<<"m_coorB.getX()"<<" "<<"m_coorB.getY()"<<endl;}錯誤提示:class "line" does not have any field named "coorB"
查看完整描述

2 回答

已采納
?
scanxu

TA貢獻3條經(jīng)驗 獲得超0個贊

Line初始化錯誤

Line::Line(int x1,int y1,int x2,int y2):m_coorA(x1,y1),coorB(x2,y2)中的coorB應(yīng)該改成m_coorB

查看完整回答
反對 回復(fù) 2016-03-01
?
MadMarical

TA貢獻79條經(jīng)驗 獲得超122個贊

你好。根據(jù)錯誤提示,你的類大小寫錯誤了。定義時為Line,示例化時為line。

查看完整回答
1 反對 回復(fù) 2016-03-01
  • 2 回答
  • 0 關(guān)注
  • 2161 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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