| An Application class which accesses an instance method in class A. | Lecture 5 - slide 34 : 45 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();
}
} | Three instances of class A. Pass the instance method MethodA together with a2 to a Messager object. Behind the scene, activates MethodA on a2. |