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 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记