• 2021-04-14
    【单选题】定义描述矩形的类 Rectangle ,描述长方体高的类 High ,其数据成员为长方体高度 H 。再由矩形类与高类多重派生出长方体类 Cuboid 。主函数中定义长方体对象并显示数据。 #include class Rectangle { protected: float Length,Width; // 数据成员为长与宽,类外不可访问 public: float Area() // 计算矩形面积的函数 { return Length*Width; } Rectangle(float L,float W ) { Length=L; Width=W; } Rectangle() { Length=0; Width=0; } }; class High{ private: float Height; // 数据成员为高度, public: High(float x=0) // 构造函数 { Height =x; } float GetH() { return Height; } }; class C
    A. Volume=Area()*GetH() ; B. Volume= Length*Width*Height ; C. Volume= Length*Width *GetH() ; D. Vol() ;
  • 举一反三