"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
"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
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
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
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 -
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
___
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):