Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interfaces and multiple inheritance

 
John Lincoln
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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


Thanks
 
Dustin Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic