Inheritance, a sub-class and a super-class!

The inheritance is when you pass properties of a parent class to hierarchy classes or what we call children classes .

So, we have the parent class which is called “super-class”, and the child class which is called sub-class. We can in fact bring some methods from a parent class and use them in a sub-class. In the pseudoclassical inheritance we inherit the parent class by using the name of class.call().

We also need to create a new prototype so we don’t overwrite the methods in the parent class and finally point the constructor to the sub-class like so :sub-class name.prototype.constructor=sub-class name.

The inheritance help us to avoid repetition and save a lot of space .