[問題] c++ 繼承問題
class Point2D{
public:
Point2D(int,int);
private:
int x,y;
};
class Point3D:public Point2D{
public:
Point3D(int,int,int);
private:
int z;
};
Point3D::Point3D(int a=0,int b=0,int c=0):Point2D(a,b),z(c){
}
與
Point3D::Point3D(int a=0,int b=0,int c=0):z(c){
Point2D(a,b);
}
所產生的結果似乎不太一樣
我想了解一下上下兩種的含意!
thx!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.75.235.127
→
05/03 15:03, , 1F
05/03 15:03, 1F
→
05/03 15:03, , 2F
05/03 15:03, 2F
→
05/03 15:05, , 3F
05/03 15:05, 3F
→
05/03 15:05, , 4F
05/03 15:05, 4F
→
05/03 15:38, , 5F
05/03 15:38, 5F
→
05/03 15:44, , 6F
05/03 15:44, 6F
→
05/03 15:44, , 7F
05/03 15:44, 7F
→
05/03 15:45, , 8F
05/03 15:45, 8F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章