Delegates: Difference between revisions

Line 1,374:
 
The task is to show a call to event when no function defined in event list, then a call to default function (as the second event has a default function), then adding new functions to events we will see how we get feedback using a function from another group.
 
We cab make Global events so we can use them without passing by reference, but code have global names references and that isn't for universal use.
 
<lang M2000 Interpreter>
Line 1,444 ⟶ 1,446:
In second example we make a Group with event objects as members. One event is private so we have to make some methods (modules inside group) to handle it. The other event is public so we can handle it from outside the object.
We can use a module B to copy this (supposed we have in module A the above program), so we can run A and B, from M2000 console and see that they have the same output.
 
Try this too: Copy Alfa and Beta events in module Checikt below, and change A definition using this A=ObjectA("Master", Alfa, Beta) so now we provide two events (passed by copy), from outside but for this group only.
 
<lang M2000 Interpreter>
Anonymous user