An Application class which accesses an instance method in class A. | Lecture 6 - slide 8 : 20 Program 3 |
using System; public class Application{ public static void Main(){ A a1 = new A(1), a2 = new A(2), a3 = new A(3); Messenger m = new Messenger("CS at AAU", a2.MethodA); m.DoSend(); } } | A client class in which we pass an instance method from an A-object to a new Messenger object. Three instances of class A. Pass the instance method MethodA together with a2 to a Messager object. DoSend activates MethodA on a2. |