Forums Register Login

Interfaces and multiple inheritance

+Pie Number of slices to send: Send
Hi,

Interfaces can extend more than one interface . Just want to why this exception for interfaces. Following code compiles


Thanks
+Pie Number of slices to send: Send
Are you asking why they can extend more than one? You're absolutely correct, the code compiles.

They can extend more than one because they are not exhibiting familial relationships, they are exhibiting BEHAVIOR. Just as in a ball can roll, it is Rollable, and a balloon can inflate, it is Inflateable, a tire has the same behavior as both of these so it could extend both Rollable and Inflateable. Behavior is a slightly different concept than inheritance.

[ March 08, 2007: Message edited by: Dustin Johnson ]
[ March 08, 2007: Message edited by: Dustin Johnson ]
keep an eye out for scorpions and black widows. But the tiny ads are safe.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 547 times.
Similar Threads
Question #4 from Doug's book
Broader exceptions thrown by methods that implement interfaces
interface
Interfaces also extend
Question on Reference assignment for Interface references..
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:02:40.