• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Casting

 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What is the difference between calling the method thru two different styles I have mentioned in the Code. One with BOLD and another with ITALIC. Both are giving the same result and why we are casting. What are the advantages of casting it?
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


This line creates an instance of Parent but not an Object of Kid()
hence casting is required in this line
Now k1 is an object of Kid and calls the method method3();

in the line k is the object of Kid() and directly calls the method3()

i hope, it will clear ur doubts. If i am wrong, please post ur correct answer in this forum

Bye for now
sat
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi small change in my previous posting




This line creates a Reference of Parent but not an Object of Kid()
hence casting is required in this line

bye for now
sat
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi small change in my previous posting




This line creates a Reference to the Parent but not an Object of Parent.
hence casting is required in this line

bye for now
sat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic