[java] How to handle two interfaces at once?
Why the hell doesn''t Java support multiple inherirance? And how the hell can I use two interfaces, both at the same time, like ActionListener and WindowListener, ?
Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;
Java supports multiple inheritance of interfaces, but only single inheritance of implementations.
From a modelling perspective, mutliple inheritance is rarely needed... most things that are done with MI can usually be done better with containment. And so, Java nicely restricts inheritance of implementation to SI.
However, there is a strong desire to require objects with a certain interface, which is why Java allows multiple inheritance of interfaces.
---- --- -- -
Blue programmer needs food badly. Blue programmer is about to die!
---- --- -- -
New York. New York. New York. Texas. Texas. New York. New York. Canada.
---- --- -- -
From a modelling perspective, mutliple inheritance is rarely needed... most things that are done with MI can usually be done better with containment. And so, Java nicely restricts inheritance of implementation to SI.
However, there is a strong desire to require objects with a certain interface, which is why Java allows multiple inheritance of interfaces.
---- --- -- -
Blue programmer needs food badly. Blue programmer is about to die!
---- --- -- -
New York. New York. New York. Texas. Texas. New York. New York. Canada.
---- --- -- -
class Whatever implements Interface1, Interface2, InterfaceN {
... do stuff
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement