|
Just finished writing an article called "Polymorphism Without Interfaces". I challenge you to review and explain the code below (it's written in ActionScript 3.0) :
for(var i:uint = 0; i < workers.length; i++) {
var p:* = workers[i]["increasePay"];
output.text+=p==undefined?"no luck":p(5);
}
The person who writes the best explanation, will get a free copy of my e-book "Java programming for kids, parents and grandparents ". I'm sure plenty of people understand the syntax, so I'm looking for an explanation of WHY it's written this way.