|Delegates that contain instance methods|
The methods on the previous page were all static. We will now explain how to deal with instance methods in relation to delegates.
In the examples until now all delegates contained static methods
In the case that delegates contain instance methods, the receiver is part the delegate
Class Messenger encapsulates a Message delegate. Via the DoSend method it is possible to activate the method(s) in the encapsulated Message delegate.
A class A with an instance method MethodA.
Illustrates how to deal with an instance method of a particular object as a delegate.
Confirms that MethodA in a2 is called.
Read more about delegates with instance methods in the text book version of this material.