PDA

View Full Version : How to understand 'Reimplemented' in qt document with 'override' 'overload' in c++



rainspider
4th December 2009, 07:01
When i read the qt document,i don't understand means of 'Reimplemented'.
eg (QLabel Class Reference) :
Reimplemented Protected Functionsvirtual (http://doc.qt.nokia.com/4.6/qlabel.html#changeEvent)
void changeEvent ( QEvent * ev )
...

what's means is there?overload or override?

:p Sorry,my English is poor.
I want to write a label's mouse-click event .eg,show some messages.

yogeshgokul
4th December 2009, 07:14
When i read the qt document,i don't understand means of 'Reimplemented'.
eg (QLabel Class Reference) :
Reimplemented Protected Functionsvirtual (http://doc.qt.nokia.com/4.6/qlabel.html#changeEvent)
void changeEvent ( QEvent * ev )
...

what's means is there?overload or override?

:p Sorry,my English is poor.
I want to write a label's mouse-click event .eg,show some messages.

It means override :)

Archimedes
4th December 2009, 07:15
It's all about virtual functions in C++. When you inherit from a class that has a virtual function you can reimplement it to suit the needs of the new class.
That means when you call the method from an object of the derived class the reimplemented version will be called instead of that in the base class.
It's different from overloading functions on how they get called and when they get resolved.