Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Using static members of a class : Accessing static members : Accessing static and instance events and event handlers
 
Accessing static and instance events and event handlers
There is no restriction on how static and instance events and event handlers are used with one another. You can subscribe a static method as a handler for an instance event or subscribe an instance method as a handler for a static event. However, as with accessing other instance members from a static method defined in the same class hierarchy, you cannot publish an instance event or subscribe any handler for an instance event from within a static method, constructor, or property accessor that is defined in the same class or class hierarchy where the instance event is referenced. You can only make reference to a public instance event from within a static method using an accessible object reference to a class instance that defines the event. For more information on publishing and subscribing handlers for class events, see Publishing and subscribing to class events.