qpushbutton 可以作为基类吗【小白求教】,该如何解决
qpushbutton 可以作为基类吗【小白求教】
就是能不能创建一个类继承qpushbutton

报错:
错误:invalid use of incomplete type 'class QPushButton'
class CmpltBut:public QPushButton
错误:forward declaration of 'class QPushButton'
class QPushButton;
------解决方案--------------------
class QPushButton; 只有声明,没有定义
也就是没有带{}的定义
------解决方案--------------------
就是能不能创建一个类继承qpushbutton
报错:
错误:invalid use of incomplete type 'class QPushButton'
class CmpltBut:public QPushButton
错误:forward declaration of 'class QPushButton'
class QPushButton;
------解决方案--------------------
class QPushButton; 只有声明,没有定义
也就是没有带{}的定义
------解决方案--------------------
#include <QPushButton>
class CmpltBut: public QPushButton{
public:
CmpltBut(QWidget* parent):QPushButton(parent),ord_squ(0){}
int ord_squ;
};