title: JavaScript call parent function from child object
body: <p>I am new to Object Oriented Programming with javascript. And trying to implement the basics that we know from other programming languages.</p>
  
  <p>I have two classes, one parent and one child. Parent have some private functions and some public functions. Child will inherit parent class.</p>
  
  <p>And I wish to access parent public function from child object. What I am trying to do:</p>
  
  <pre><code>function SuperClass {
      //Constructor implementation of this class
  
      //public functions
      return {
          parentPublicFunction: function() {
              //Public function implementation
          }
      }
      function privateFunction() {
          //Private function implementation.
      }
  }
  
  //Inheriting
  childClass.prototype = Object.create(SuperClass.prototype);
  childClass.prototype.constructor = childClass;
  childClass.prototype.parent = SuperClass.prototype;
  function childClass {
      //Call to super constructor
      this.parent.constructor.call(this, arguments);
  
      //Public function for childClass.
      return {
          childPublicFunction: function() {
              //function implementation
          }
      }
  }
  
  var childObj = new childClass();
  childObj.parentPublicFunction();
  </code></pre>
  
  <p>I am getting this error when running this:</p>
  
  <blockquote>
    <p>Uncaught TypeError: undefined is not a function</p>
  </blockquote>
  
  <p>Am I doing something which is incorrect.? Thanks in advance!</p>