question about inheritance
- From: John <printdude1968@xxxxxxxxx>
- Date: Sat, 10 Feb 2007 03:18:38 GMT
Now that I am understanding the concept of inheritance better, I decided to test myself. I won't show all the code here, but basically I have the following class structure
Species:
Mammal
Feline
Tiger
Housecat
Lion
Canine
domesticDog
wolf
fox
Human
Reptile
if class Housecat extends Feline
and if class Feline extends Species
can an object of type Housecat use the methods defined in Species even though it doesn't inherite from Species directly? My understanding would be that it can because, if I understand correctly, all subclasses inherite from the super class that it extends, which also makes available the methods and instance variables (that are public) from the entire hierachy up.
Basically what I'm asking is,
if Species.name is an instance variable public in Species,
does fox.name refere to anything or is it an error?
.
- Follow-Ups:
- Re: question about inheritance
- From: maitreya
- Re: question about inheritance
- Prev by Date: Re: classpath
- Next by Date: Re: JVM stack error?
- Previous by thread: classpath
- Next by thread: Re: question about inheritance
- Index(es):
Relevant Pages
|