title: Basic Inheritance in Python?
body: <p>I'm trying to teach myself inheritance using a simple example in Python but I can't seem to grasp the basics. I'm trying to use the add function defined in the MathOps class and use it in the Inherited class. What am I missing?</p>
  
  <pre><code>def main():
      result = Inherited(2,4)
      print result.add()
  
  class MathOps:
      def __init__(self,a,b):
          self.a = a
          self.b = b
  
      def add(self):
          sum = self.a + self.b
          return sum
  
      def multiply(self):
          product = self.a * self.b
          return product
  
  class Inherited(MathOps):
      def __init__(self,a,b):
          self.add()
          return sum
  
  if __name__ == '__main__':
      main()
  </code></pre>