• Post Reply Bookmark Topic Watch Topic
  • New Topic

Confusion when an Interface extends more than one interface  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please find the below code and tell me why everytime I! gets printed as output?











Thanks in advance
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santosh Bobade wrote:
Please find the below code and tell me why everytime I! gets printed as output?



Because an I3 instance IS-A I1 instance. An I3 instance also IS-A I2 instance, but you don't print I2 if it is an I2 instance. Perhaps you should change your code to two separate if statements, to see it better.



Henry
 
Santosh Bobade
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Good observation. My silly mistake
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!