| ☞ |   Program
    Repair Shop ![]()  | 
    6 | 
Idea: Say that Alarm inherits from Class::Observable
It then inherits two methods:
->add_observer
->notify_observers
When it calls ->notify_observers, each observer's ->update method is called
An observer can be an object that supports an ->update method
It can also be the name of a class that supports an ->update method
It can also be a plain subroutine, which is invoked
     my $alarm = Alarm->new();  # Alarm inherits from Class::Observable
     my $guard  = Guard->new();
     
     $alarm->add_observer($guard);   # Inherited method
     
     ...
     
     $alarm->notify_observers(...);    # Inherited method
     # Calls $guard->update(...);
Why not $guard->notify(...)?
I don't know
continued...
| ☞ | ![]()  | 
    ☞ |