Re: [Tutor] Using class methods

2011-06-21 Thread Alan Gauld
"Christopher King" wrote class Farm_class(object): ... or if you want to use a method of the Critter class within the farm do class Farm_class(object): But please do NOT add '_class' to the end of your class names! The fact that it has a capital letter at the front combined with context

Re: [Tutor] Using Class methods

2011-06-21 Thread Alan Gauld
"David Merrick" wrote I need help using Class methods in another class. I have a class called Critter and I want to create two critters in a farm Class Farm and use Class Critter's methods Ok, You seem to be a bit confused by OOP, and your code is using all sorts of features you probably

Re: [Tutor] Using class methods

2011-06-21 Thread Christopher King
Well it depends what you mean. If you have a critter object and want to invoke its method inside the farm, do somethinh like this. class Farm_class(object): def feed(self, critter): critter.eat(self.food) or if you want to use a method of the Critter class within the farm do class Farm_clas

Re: [Tutor] Using Class methods

2011-06-21 Thread col speed
and? On 21 June 2011 14:38, David Merrick wrote: > I need help using Class methods in another class. I have a class called > Critter and I want to create two critters in a farm Class Farm and use > Class Critter's methods > > -- > Dave Merrick > > merrick...@gmail.com > > Ph 03 3423 121 > Cel

Re: [Tutor] Using class methods

2011-06-21 Thread Andre Engels
On Tue, Jun 21, 2011 at 10:12 AM, David Merrick wrote: > I need help using Class methods in another class. I have a class called > Critter and I want to create two critters in a farmĀ  Class Farm and use > Class Critter's methods Could you please specify where your current code does not suffice -

[Tutor] Using Class methods

2011-06-21 Thread David Merrick
I need help using Class methods in another class. I have a class called Critter and I want to create two critters in a farm Class Farm and use Class Critter's methods -- Dave Merrick merrick...@gmail.com Ph 03 3423 121 Cell 027 3089 169 critter_farm2.py Description: Binary data ___

[Tutor] Using class methods

2011-06-21 Thread David Merrick
I need help using Class methods in another class. I have a class called Critter and I want to create two critters in a farm Class Farm and use Class Critter's methods # A virtual pet to care for class Critter(object): """A virtual pet""" def __init__(self, name, hunger = 0, boredom = 0):