Constructors Demo : Class Constructor : Class PYTHON examples


PYTHON examples » Class » Class Constructor »

 

Constructors Demo


Constructors Demo



class Critter(object):
    """A virtual pet""" 
    def __init__(self):
        print "A new critter has been born!"

    def talk(self):
        print "nHi.  I'm an instance of class Critter."

# main
crit1 = Critter()
crit2 = Critter()

crit1.talk()
crit2.talk()


           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Class
» Class Constructor