Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explanation for the statements

 
Sathya Shanmugam
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends

Pls give some detail explanation with example for the following statements from KB book


" A Single object can be referred to by reference variable of many different types - as long as they are the same type or a super type of the object"
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider this example.



There is only one D object created, but it can be referred to as an A, a B, a C, or a D.
 
Sathya Shanmugam
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Keith, now I understood the statement clearly with your example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic