风雨兴 发表于 2021-4-17 17:49:47

c++ 类的继承

题目要求:每个二维图形类应包括图形名、平面位置(Point2D点对象)、边长或半径等数据成员,成员函数包括默认及有参构造函数,并实现计算二维图形的面积和周长,以及输出基本信息等功能。

问题:输出结果出问题
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhkAAACPCAYAAABXusn8AAAgAElEQVR4Ae1du67kyJEtyJ76AP3Goix9hIAWIHClmdFrgHEaENqitz/QThvEeho9R88ZPShhBBmzfhtljNNmf0suIpJBRgYjyWQVeYu36hgXWZdMZkZGnMw4+T78/Oc/D9/61rfCy5cvwwcffIA/6AAYAAaAAWAAGAAGVsHAASQDxArk8vEwcDyewqmqQlXVoW7a0NanixuU4ymm0zR1OB2PF6cDHD4eDmHz+7c5SMYDsVVyLHV7Dudz5q/dxkmc6nacZ9uGpq6yTmmQtQnVM3Zcey0Hy9U0oWma0J7PkyTjVMU4gpu2qUNVV71dTlUdGsLVRviBI7p/RwQb36+Nny3JiI3kNk5xDcDvUb7jsQrNuQnVKfY2q2ZwLtQbbdrtHPqxahIndOL8ph0TO68rethr2HGNNPZeDiKBuZEMslvbDGSQcF01RBrbUHc4Ih1Z+66hN6Rxv44Htn0c2z5jkkFOcc8kY3/yHU91aJTT1iSDKv2pbhLHsWZD4DmhSHoGorNmfkirvBHLkQwmym1KJkSvRDRAMsp1LHpDCJ09GgYOh8Mh0N9zWvgZe1PTveBbGnKv8h1pDl5NPViSwXPrqne6pg49kkHpx6kUfwSF9Hi6Up7j6ZSdklmzfFNprVGOqfSvfZcnGTTylZIJyYsIa10N6y9y9pX4COFcgYHHxMDhm2++CW/fvk1IRnSSah699Xu45JRo0Vg/V0vD7copcM+Z5nx5QdhJxaX5+PFCszhkP6R3bmnOuB45RskvCdWohuTbtG1oaXrgeAwx7W4tQhc3OriUrNC3NEdth4OpgpTohRx3Ipesf1DyLa1sPCeu11IYPS9NT+JbkhHLSI5F6YmmObr/m+oYhvINxGAOB5yumS4RGdg5KUdGOtbr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nj+gFxXqIDT1f03VVTJbwoUmSTfEW2+Fznyw5G648W0SoiZ3VyrXw2PVqQG/Uxtlu0MW3llTj581Jsurn/xdGKDabOyZjK91L7TpVXnH0vm9QVNfqyNF9dP/nsi26tS2N2HJXgQNLK1dmczvF83QYY+oQ+7x0DCcm498I+dfmoN28PEntqGaby27t8U7LjHRpnYAAYAAb2jwGQjJWveufedX2Ku0rMFt09VIi9y7cHHUGG/TdcsBFsBAw8DwyAZKxMMuI6gzOfDrrHUYy9y4eG43k0HLAT7AQMAAMlGADJWJlklCgdcVA5gQFgABgABh4BAyAZIBn9ds9HADzKiIYdGAAGgIGnwwBIBkgGSAYwAAwAA8AAMLAJBkAyAKxNgIWewtP1FKBr6BoYAAb2igGQDJAMkAxgABgABoABYGATDIBkAFibAGuvrBpyoccHDAADwMDTYQAkAyQDJAMYAAaAAWAAGNgEA4evv/46fPXVV+GTTz7ZJAMwxqdjjNA1dA0MAAPAADCwJwwc3r9/H969exdevXoFkgEmCwwAA8AAMAAMAAOrYQAkA2BaDUx7Ys+QBb05YAAYAAZujwGQDJAMkAxgABgABoABYGATDIBkAFibAAs9iNv3IGAD2AAYAAZujQGQDJAMkAxgABgABoABYGATDIBkAFibAOvW7Bn5owcHDAADwMDtMQCSAZIBkgEMAAPAADAADGyCAZAMAGsTYKEHcfseBGwAGwADwMCtMQCSAZIBkgEMAAPAADAADGyCAZAMAGsTYN2aPSN/9OCAAWAAGLg9Bg7/fTiEw+EQvv3tb8PZgHAAA8AAMAAMAAPAwGoYOPzX//wfjhUHoFYDFHoOt+85wAawATAADOwFA5guAcEAwQAGgAFgABgABjbBAEgGgLUJsPbCoiEHenTAADAADNwOAyAZIBkgGcAAMAAMAAPAwCYYAMkAsDYBFnoOt+s5QPfQPTAADOwFA4f//uw9Fn6CaIBoAAPAADAADAADq2Pg/wH5d0d69YmDZgAAAABJRU5ErkJggg==

求大佬教教在下是为什么输出这么个东西,求改正,谢谢您了{:5_111:}

代码:设置类Shape,类TwoDiemnsionalShape,类Square,具体如下:

#include <iostream>
#include<cstring>

using namespace std;


class Shape
{
public:
    virtual void print()=0;
    virtual void show()=0;
    virtual double getV()=0;
    virtual double getArea()=0;
};

class TwoDiemnsionalShape:public Shape
{
private:
    double x,y;
public:
    TwoDiemnsionalShape(double xx=0,double yy=0):x(xx),y(yy)
    {
      cout <<"construct a TwoDiemnsionalShape"<<endl;
    }
    virtual ~TwoDiemnsionalShape()
    {
      cout <<"destruct a TwoDiemnsionalShape" <<endl;
    }
    void print()
    {
      cout <<"center:" <<x <<"," <<y <<endl;
    }
};

class Square:public TwoDiemnsionalShape
{
private:
    double side;
    char name;
public:
    Square():TwoDiemnsionalShape(0,0)
    {
      side = 1;
      strcpy(name,"Square");
      cout <<"construct a Square" <<endl;
    }
    Square(double x,double y,double s,char *n):TwoDiemnsionalShape(x,y)
    {
      side = s;
      strcpy(name,n);
      cout <<"construct a Square" <<endl;
    }
    ~Square()
    {
      cout <<"destruct a Square" <<endl;
    }
    void show()
    {
      cout <<"Square:" <<name <<endl;
      print();
      cout <<"面积为:" <<getArea();
    }
    double getArea()
    {
      return side*side;
    }
    double getV()
    {
      return 0;
    }
};


int main()
{
    Square s(1,1,1,"S1");
    s.show();
    return 0;
}

yuxijian2020 发表于 2021-4-17 19:37:20

你输出了啥啊?

风雨兴 发表于 2021-4-17 20:05:32

construct a TwoDiemnsionalShape
construct a Square
Square:S1
center:锛?

我的天,我不知道怎么发图片{:10_269:}

风雨兴 发表于 2021-4-18 10:57:23

没事了,我换了个编译器就好了{:10_266:}{:10_257:}
页: [1]
查看完整版本: c++ 类的继承