with kind regards,<br />Ravi
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
posted by Thomas Paul
How could this compile if Dog didn't inherit fur?
code:
--------------------------------------------------------------------------------
class Fur {}class Pet { Fur fur = new Fur(); }public class Dog extends Pet {Fur a = fur;}
--------------------------------------------------------------------------------
not so smart guy still curious to learn new stuff every now and then
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Francis Siu
SCJP, MCDBA
Originally posted by Thomas Paul:
We seem to be getting confused with inheriting and extending. When I extend a class, I inherit all the non-private members of the class that I extend.
Originally posted by Lih Wang:
As I understood it, subcalss inherits everything from its superclass. The access modifier private would not prevent inheritance but would prevent access (overloading/overriding) by a subclass. Am I right?
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|