Demonstrates a basic class and object : Class Define « Class « Python






Demonstrates a basic class and object

Demonstrates a basic class and object
# Demonstrates a basic class and object 

class Critter(object):
    """A virtual pet"""
    def talk(self):
        print "Hi.  I'm an instance of class Critter."

# main
crit = Critter()
crit.talk()



           
       








Related examples in the same category

1.A very simple class definition.A very simple class definition.