• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Casting

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic