我正在学习Qt,发现了这个:
Widget::Widget(QWidget *parent)
: QWidget(parent), ui(new Ui::WidgetClass)
{
ui->setupUi(this);
}
Run Code Online (Sandbox Code Playgroud)
什么是":QWidget(父),ui(新Ui :: WidgetClass)"是什么意思?
我怎样才能获得关于此的C++文档?
这对Qt来说并不特别,只是C++的一部分.
: QWidget(parent) 只是调用基础构造函数.
ui(new Ui::WidgetClass) 只是一个被初始化的成员.
例:
class B
{
public:
B(int x)
{
myx = x;
}
int myx;
};
class D : public B
{
public:
D()
: B(4), p(new char[1024])
{
}
~D()
{
delete[] p;
}
char *p;
};
Run Code Online (Sandbox Code Playgroud)