|
-
December 23rd, 2008, 12:33 AM
#8
Re: Need a clear definition for what a callback is?
 Originally Posted by RickyWh
Very strange concept, thanks for the help everyone. I'll have to probably see a useful example in order to fully understand it.
Psuedo Code...
Code:
LogToFile () { Write Information to a File }
LogToConsole() { Write Information to Console }
void DoWork(CallBack)
{
Some Work
if (Error)
CallBack(ErrorMessage)
}
Now you can:
Code:
DoWord(LogToFile); // Will log errors to the file
DoWork(LogToConsole) // Will log Errors to the Console.
Further more you can create additional callbacks later to perform functions which could not possibly have been concieved when DoWork was writter...Then just callDoWork passing the new callback routine.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|