Public attributes (using this. modifier) can be overwritten, while private attributes (using VAR modifier) cannot be overwritten.
The subclass cannot access the private attributes of the parent class. The method of the parent class can normally access the private variables of the parent class.
Function vegetable () {This. Taste = 'delimiter'; var A = 'I \'m vegetable \ 'a! 'This. fun1 = function () {alert ('vegetable fun1 doing... ');} This. fun3 = function () {alert (a) ;}} function celery () {var A = 'I \'m celery \ 'a'; this. color = 'green'; this. taste = 'bad'; this. fun1a = function () {alert ('celeryfun1 doing... ');} This. fun2 = function () {alert ('celery fun2 doing... ');} This. fun4 = function () {alert (a) ;}} celery. prototype = new vegetable (); var stick = new celery (); var polymorphed = stick. taste; // alert (polymorphed); // alert (stick. color); // stick. fun1 (); // stick. fun2 (); // stick. fun3 (); stick. fun4 ();