J
jimbo
Dear all,
I am more or less new to c++ programing and therefore still have
problems with some fundamentals
At the moment I try to build a GUI-Application with Qt4. Sometimes I
have seen in the tutorials I have to instance a class with the new
command. Like QWidget QLabel *label = new QLabel("Hello World"); Then
I have created a pointer to a QLabel Object. The other way I have seen
is to just use QLabel label("Hello World"); Without a pointer and
without the new statement.
So to access the functions of the QLabel class I have to use the "."
for the part without pointer like label.show and for the pointer part:
label->show.
Can somebody explain me, why it is possible to use the two ways and
what is the difference in general.
Thank you a lot in advance.
jimbo
I am more or less new to c++ programing and therefore still have
problems with some fundamentals
At the moment I try to build a GUI-Application with Qt4. Sometimes I
have seen in the tutorials I have to instance a class with the new
command. Like QWidget QLabel *label = new QLabel("Hello World"); Then
I have created a pointer to a QLabel Object. The other way I have seen
is to just use QLabel label("Hello World"); Without a pointer and
without the new statement.
So to access the functions of the QLabel class I have to use the "."
for the part without pointer like label.show and for the pointer part:
label->show.
Can somebody explain me, why it is possible to use the two ways and
what is the difference in general.
Thank you a lot in advance.
jimbo