I'M reading a book on Python and my very first object/constructor program isn't show the output that the book is showing. I lacks the two lines "A new critter has been born!"
# Constructor Critter
# Demonstrates constructors
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()
raw_input("\n\nPress the enter key to exit.")
So what are objects all about anyway? It looks to me like a long complicated way of walling a function or method.