Home » U++ Library support » U++ Callbacks and Timers » Virtual functions versus callbacks
Virtual functions versus callbacks [message #24202] |
Tue, 05 January 2010 09:59 |
|
koldo
Messages: 3372 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
To let the program do actions after events I have seen there are two options in Upp:
- To use "virtual" functions
For example to get the "enter" key in an EditField it is necessary to do a derived class
that catches virtual bool Key(dword key, int rep);
- To use callback
For example to do something after clicking in an ArrayCtrl it could be done by assigning a callback function to "WhenLeftClick".
From the user (programmer) point of view it seems better callback functions as you do not need to do derived classes every time you need a certain response after a Ctrl event.
Personally I stronger prefer callback but, what do you think about it ?
Best regards
Koldo
Best regards
IƱaki
|
|
|
Goto Forum:
Current Time: Mon Jun 03 22:57:40 CEST 2024
Total time taken to generate the page: 0.01836 seconds
|