title: Classes, Hidden Attributes and Inheritance
body: <p>I am pretty new to OOP and Python. Pretty much everything that I know is self-taught, so I would be grateful if you can provide just links for me to read since I do not know the exact terminology that I should seek in order to clarify my doubts.</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>class Point(object):
      x = 2
      y = 3
  
      def __init__(self, x, y):
          self.x_a = x
          self.y_b = y
  
  class RectPoint(Point):
  
      def __init__(self, x, y):
          self.x_1 = x
          self.y_1 = y
          self.dist = (x*x + y*y)**0.5
  
  
  class CircPoint(Point):
      pass
  
  a = Point(3,4)
  b = CircPoint(3,4)
  c = RectPoint(3,4)
  
  print a.x     # 2
  print a.y     # 3
  print a.x_a   # 3
  print a.y_b   # 4
  print b.x     # 2
  print b.y     # 3
  print b.x_a   # 3
  print b.y_b   # 4
  print c.x     # 2
  print c.y     # 3
  print c.x_1   # 3
  print c.y_1   # 4
  print c.dist  # 5.0
  print c.x_a   # AttributeError
  print c.y_b   # AttributeError
  </code></pre>
  
  <p>Why are the attributes <code>self.x_a</code> and <code>self.y_b</code> not available for the class <code>RectPoint</code> but available for <code>CircPoint</code>? How would I make them available?</p>
  
  <p>Further, why are the <code>self.x</code> and <code>self.y</code> available for the two classes <code>RectPoint</code> and <code>CircPoint</code>?</p>
  
  <p>Links for further reading would also be appreciated (in place of an explanation)</p>