c++构造函数,vs2010报错说有返回值,求给看看
Box::Box(doubleaLength,doubleaWidth,doubleaHeight){length=aLength>0.0?aLength:1.0;wid...
Box::Box(double aLength,double aWidth,double aHeight){
length=aLength>0.0? aLength:1.0;
width =aWidth >0.0? aWidth :1.0;
height=aHeight>0.0? aHeight:1.0;
}
class Box{
public:
Box(double aLength=1.0,double aWidth=1.0,double aHeight=1.0);
double volume() const;
double getLength() const;
double getWidth() const;
double getHeight() const;
int compareVolume(const Box& otherBox) const;
private:
double length;
double width;
double height;
} 展开
length=aLength>0.0? aLength:1.0;
width =aWidth >0.0? aWidth :1.0;
height=aHeight>0.0? aHeight:1.0;
}
class Box{
public:
Box(double aLength=1.0,double aWidth=1.0,double aHeight=1.0);
double volume() const;
double getLength() const;
double getWidth() const;
double getHeight() const;
int compareVolume(const Box& otherBox) const;
private:
double length;
double width;
double height;
} 展开
展开全部
类中构造函数中不是已经初始化了吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
CPP里的代码呢?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询