April 2017
Beginner to intermediate
394 pages
9h 16m
English
This type of decoupling isn't talked about much because it only applies to a few situations and, most of the time, this isn't what we want. Usually, when we call a function we want it to execute immediately. We have a specific algorithm in our code and the timing and order of that code is very important. This isn't true of all code. One situation is multithreaded code, in which multiple paths of code are executing simultaneously. Other situations are UI or context sensitive buttons, where the action to be executed is set up in advance instead of hardcoded in place. Let's look at some code as an example:
//Examples of setting up function calls //Immediate execution Add(5, 6); //Delayed execution Command* p1 = new TwoArgCommand(Add, ...
Read now
Unlock full access