Advanced constructor declaration

Hi. can someone help me interpret what this means in general?

GLWindow(QWidget *parent)
: QGLWidget(parent) {} //especially this line

The top line is the constructor with it's in parameters, but what does the seccond line mean? and why can't I write

GLWindow::GLWindow(QWidget *parent)
: QGLWidget(parent) {
initializeGL();
}
Means that when I'm Initializing my object I wan't to run my function initializeGL()
Last edited on
1
2
GLWindow(QWidget *parent)
: QGLWidget(parent) {} //especially this line 
Is calling QGLWidget constructor, GLWindow seems to be derived from it
Ok. that's true. But if I'd in my cpp file write a body, as eg above shows, visual say that I can't do that since it already has a body. what should I do if I want to write a body for the constructor?
Remove the line : QGLWidget(parent) {} from your header so you can write a body for the function in the source file
ok. so is ": QGLWidget(parent) {}" inline or something?
All the function defined in the class body are inlined - as long as the compiler inlines them -
Anyway, that has an empty body {} so it doesn't matter much
Last edited on
Topic archived. No new replies allowed.