I’m a bit puzzled.
I thought that if a class implements an interface then it has to implement all methods defined in the interface. However I’m looking at code that does the following:
It has an interface with methods that seem to mimic events:
myInterface
- MouseUp
- MouseDown
- Paint
A class cLevel1 implements the Interface, and has corresponding event definitions. In each interface method it raises the corresponding event.
cLevel2 is a subclass of cLevel1 and inherits the Interface - but it does not implement any of the methods.
So I presume my assumption about interfaces does not extend to inherited interfaces? Because subclasses inherit the methods?
But why not simply use the events? What’s the point of using an interface if all you do is call the corresponding events?