I am trying to understand how inheritance works in JS. Suppose we have a class:
Class = function () { this.A = 'A'; this.B = 'B'; };
and we are trying to expand it
SubClass = function () {}; SubClass.prototype = new Class();
I understand correctly that after inheritance properties A and B are common to all instances of SubClass , since they belong to the prototype? If so, how can Class be extended so that A and B not part of the prototype?
UPD: note that Class uses A and B , so I cannot declare them in SubClass.
Thank you in advance!
source share