title: Python inheritance - object has no attribute error
body: <p>I am experimenting with basic python inheritance with a Dog class that inherits from an Animal class. For some reason, my Dog object is not inheriting <code>name</code> correctly and I keep getting <code>AttributeError: 'Dog' object has no attribute '_Dog__name'</code>. Does anyone know what might be going on? My code is below:</p>
  
  <pre><code>class Animal(object):
      __name = None #signifies lack of a value
      __height = 0
      __weight = 0
      __sound = 0
  
      def __init__(self, name, height, weight, sound):
          self.__name = name
          self.__height = height
          self.__weight = weight
          self.__sound = sound
  
  
  class Dog(Animal):
      def __init__(self, name, height, weight, sound, owner):
  
          super(Dog, self).__init__(name, height, weight, sound)
  
          self.__owner = owner
          #self.__name = name this works if I uncomment this line.
  
      __owner = ""
  
      def toString(self):
          return "{} belongs to {}".format(self.__name, self.__owner)
          #return 'Sup dawg'
  
  fido = Dog("Spot", 3, 4, "Woof", "John")
  
  print(fido.toString())
  </code></pre>