Well I'm teaching myself about python classes and when I run my code I get the following error:
class Critter(object):
"""A virtual pet"""
def _init_(self, name, mood):
print("A new critter has been born!!!!!")
self.name = name
self.__mood = mood
def talk(self):
print("\n Im",self.name)
print("Right now I feel",self._mood)
def _private_method(self):
print("this is a private method")
def public(self):
print("This is a public method. ")
self._private_method( )
crit = Critter(name = "Poochie", mood = "happy")
crit.talk( )crit.public_method( )
input("Press enter to leave")
I receive the error:
Traceback (most recent call last):
File "/Users/calebmatthias/Document/workspace/de.vogella.python.first/practice.py", line 27, in <module>
crit = Critter(name = "Poochie", mood = "happy")
TypeError: object.__new__() takes no parameters