单选题
适中
#21081
运行下列代码,屏幕上输出( )。 # include <iostream> using namespace std ; class shape { protec…
运行下列代码,屏幕上输出( )。
答案与解析
正确答案:A
解析
主函数实例化两个对象rectangle rec 和triangle tri,pshape调用rec的area()方法,输出了rectangle area:,之后pshape调用tri的area()方法,输出了triangle area: