# include<iostream.h>
class BOX
{
int height,width,depth;
public:
BOX(){/*does nothing*/};
BOX(int ht=1,int wd=2,int dp=3)
{
height=ht;
width=wd;
depth=dp;
}

展开全部
收起
6回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • Priya

    20人对此回答表示赞同

    #include <iostream>
    using namespace std;
    class BOX
    {
    int height,width,depth;
    public:
    BOX(){/*does nothing*/};
    BOX(int ht=1,int wd=2,int dp=3)
    {
    height=ht;
    width=wd;
    d
    展开
    20
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • 多面体

    14人对此回答表示赞同

    1、 BOX() {}函数声明和定义都给出了不需要加个分号
    2、 对象构造:BOX *thisbox = new BOX(7, 8, 9);
    BOX *otherbox = new BOX();
    第一个BOX thisbox(7, 8, 9)编译器可能还能知道你是干嘛。第二个你是要声明一个返回BOX值 名为otherbox的函数?
    3、然后把一个对象赋给一个函数?otherbox = thisbox;
    展开
    14
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • 木头老兄

    8人对此回答表示赞同

    这个,至少有5个错误~~~
    展开
    8
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • 兵荒马乱

    7人对此回答表示赞同

    #include<iostream.h>
    class BOX
    {
    int height,width,depth;
    public:
    BOX()
    {/*does nothing*/}
    BOX(int ht=1,int wd=2,int dp=3)
    {
    height=ht;
    width=wd;
    depth=dp;
    展开
    7
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Axl木子

    5人对此回答表示赞同

    1. BOX otherbox();
    实例化调用无参构造函数时不用加括号,加了反而造成错误,编译器会认为你试图声明一个返回值为BOX的无参函数。

    2.BOX(){/*does nothing*/};
    BOX(int ht=1,int wd=2,int dp=3)
    第二个构造函数中所有参数均带有默认值,与无参数默认构造函数冲突。则在构造
    BOX otherbox;
    的时候编译器不能确定你要调用的是无参数版本的重载,还是以默认值调用
    展开
    5
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Miroslavkk

    4人对此回答表示赞同

    # include<iostream>
    using namespace std;
    class BOX
    {
    int height,width,depth;
    public:
    BOX(){}
    BOX(int ht,int wd,int dp)
    {
    height=ht;
    width=wd;
    depth=dp;
    }
    展开
    4
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部