m0_54228023 2021-07-03 22:54 采纳率: 100%
浏览 14
已采纳

语句无法解析重载高数的地址怎么解决

#include
using namespace std;

class Point{
int x,y;
public:
Point(int x0=0,int y0=0):x(x0),y(y0){}
double getx(){return x;}
double gety(){return y;}
};

class Rectangle{
Point c1;
int length,width;
public:
Rectangle(){}
Rectangle(int x,int y,int x1,int y1,int x2,int y2):c1(x,y),length(x2-x1),width(y2-y1){}
int area(const Rectangle &a);
void display(){
cout<<"矩形坐标:"<<"("<<c1.getx()<<","<<c1.gety()<<")"<<endl;
cout<<length<<" "<<width<<endl;
}
};

class Circle{
Point c2;
int r;
public:
Circle(){}
Circle(int x,int y,int i):c2(x,y),r(i){}
};
int Rectangle::area(const Rectangle &a){
int i;
i=length*width;
return i;
}

class Cuboid:public Rectangle,Circle{
Rectangle b;
int high,volume;
public:
Cuboid(Rectangle &Rec,int h,int v):b(Rec),high(h),volume(v){}
void Vol(const Cuboid &a);
void show();
};
void Cuboid::Vol(const Cuboid &a){
volume=high*area(b);
}
void Cuboid::show(){
Rectangle::display();
cout<<high<<volume<<endl;
}

int main(){
Rectangle a(10,10,10,20,30,30);
Cuboid c(a,10,10);
c.show;
return 0;
}
主程序中的c.show无法解析重载函数的地址,该如何解决

  • 写回答

2条回答 默认 最新

  • CSDN专家-link 2021-07-03 22:55
    关注

    c.show();函数要带括号

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)