執(zhí)行結(jié)果問題
#include<iostream>
#include"Circle.h"
#include"Rect.h"
#include"Shape.h"
using namespace std;
int main()
{
Shape *shape1 =new Rect(4,5);
Shape *shape2 = new Circle(6);
shape1->calcArea();
shape2->calcArea();
delete shape1;
shape1 = NULL;
delete shape2;
shape2 = NULL;
system("pause");
return 0;
}
運(yùn)行結(jié)果shape1中不跳至Rect類,為什么啊
2019-10-04
不是跳轉(zhuǎn)了么,shape(),rect()
2018-11-12
附上圖