📄 shape1.cpp
字号:
#include "shapes.h"#include <QString>#include <QDebug>void showNameAndArea(Shape* pshp) { qDebug() << pshp->getName() << " " << pshp->getDimensions() << " area= " << pshp->area();}int main() { Shape shp; /* ERROR - instantiation is not allowed on classes with pure virtual functions */ Rectangle rectangle(4.1, 5.2); Square square(5.1); Circle circle(6.1); qDebug() << "This program uses hierarchies for Shapes"; showNameAndArea(&rectangle); showNameAndArea(&circle); showNameAndArea(&square); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -