Can I inherit member variables?

Gabriel Genellina gagsl-py at yahoo.com.ar
Thu Sep 21 06:49:55 EDT 2006


At Thursday 21/9/2006 07:34, LorcanM wrote:

>I think there's a basic misunderstanding about the nature of
>inheritance on my side.
>
>What I want to do is instantiate the sub class (derived class) from
>within the animal class. I then expect the sub class to have inherited
>some basic properties that it knows it has (weight, colour). If I can
>expand the example I gave previously to try to make this a little
>clearer:

As an analogy: a certain animal, a given individual, is of a kind 
"from birth". You don't have an abstract, unshaped, animal, that by 
some kind of magic later becomes a bird, or a mammal...
When you construct an object instance, it is of a certain type from 
that precise moment, and you can't change that afterwards.
So, you construct a bird, which is a kind of animal (class 
inheritance is the way of modelling that "is a kind of" relationship).

Hope it becomes clearer now.



Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list