首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

本人新手,下面的代码编译时为什么出现有关问题,多谢

2013-10-30 
本人新手,下面的代码编译时为什么出现问题,谢谢#includeiostreamusing namespace stdclass Point{publi

本人新手,下面的代码编译时为什么出现问题,谢谢
#include<iostream>
using namespace std;
class Point
{
public:
Point(float x,float y)
{
X=x;
Y=y;
}
protected:
float X,Y;
};

class Rectangle:public Point
{
public:
Rectangle(float x,float y,float l,float w);
protected:
float L,W;
};

class Cube:public Rectangle
{
Cube(float x,float y,float z,float l,float w,float h);
protected:
float Z,H;
};

Rectangle::Rectangle(float x,float y,float l,float w):Point(x,y)
{
L=l;
W=w;
}

Cube::Cube(float x,float y,float z,float l,float w,float h):Rectangle(x,y,l,w)
{
Z=z;
H=h;
}

int main()
{
Cube c(2,3,4,5,6,7);
return 0;
}
[解决办法]


class Cube:public Rectangle
{
public:  //构造函数要为public
Cube(float x,float y,float z,float l,float w,float h);

热点排行