• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Conversion and Casting

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a question from robers&heller's certification guide.
What does it mean to assign an object reference to an interface?
For eg., consider the code below.
(Class Mammal is the super class.
Class Raccon inherits from Mammal and implements Washer.
Class SwamThing inherits from Mammal but doesn't implement Washer.)
Now here is the code.
Raccon rocky;
SwampThing pogo;
Washer w;
rocky = new Raccon();
w = rocky;
pogo = w;
After "w = rocky", doesnt "w" (interface) become an object reference to "rocky" class??
What will happen at the next line "pogo = w"? Is "w" still a an interface??
Please, somebody explain. I'd appreciate it very much.


[This message has been edited by cowboy55 (edited June 25, 2000).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic