[Tutor] constructor

Lie Ryan lie.1296 at gmail.com
Sun Apr 4 20:27:00 CEST 2010


On 04/05/10 04:11, Shurui Liu (Aaron Liu) wrote:

> But the result I got from computer is like this:
> A new critter has been born!
> A new critter has been born!
> 
> Hi.  I'm an instance of class Critter.
> 
> Hi.  I'm an instance of class Critter.

Because you tell it to do it in that order:

crit1 = Critter() # A new critter has been born
crit2 = Critter() # A new critter has been born
crit1.talk() # Hi.  I'm an instance of class Critter.
crit2.talk() # Hi.  I'm an instance of class Critter.




More information about the Tutor mailing list