首页 > 试题广场 >

以下程序的运行结果是() #include usi

[单选题]
以下程序的运行结果是()

#include<iostream>
using namespace std;
class A{
 public:
 void set(int I,int j)
    {
        x=i;    
        y=j;
     }
   int get_y()
    {
        return y;
    }
private:
 int x,y;
};

class box
{
    public:
    void set(int l,int w,int s,int p)
    {
        length=l;
        width=w;
        label.set(s,p);
    }
    int get_area()
    {
    return length*width;
    }
private:
    int length,width;
    A label;
};

int main()
{
 box b;
 b.set(4,6,1,20);
  cout<<b.get_area()<<endl;
 return 0;
}

  • 24
  • 4
  • 20
  • 6
推荐
说明:本题练习对象成员的应用。类box中的数据成员包括了类A的对象lable,用于标识box对象在坐标上的位置。
发表于 2018-05-05 21:19:26 回复(0)
更多回答
我相信你做对了
发表于 2019-12-05 23:15:06 回复(0)
写这代码的可以开除了
发表于 2022-04-26 15:07:36 回复(1)
这么长的题干配合答案的4*6,我。。。。
发表于 2021-01-27 11:42:10 回复(0)
4*6=24。。。。。
发表于 2021-01-05 08:22:16 回复(0)
这个就直接用length*width就可以了

发表于 2018-12-07 14:03:50 回复(0)