$.inherit([ base ], methods , [ statical ])
* This source code was highlighted with Source Code Highlighter .
//
var A = $.inherit(
{
__constructor : function (property) {
this .property = property;
},
getProperty : function () {
return this .property;
},
getStaticProperty : function () {
return this .__self.getStaticProperty();
}
},
{
staticProperty : 'static property of A' ,
getStaticProperty : function () {
return this .staticProperty;
}
});
//
var B = $.inherit(
A,
{
getProperty : function () {
return this .__base() + ' in B' ;
}
},
{
staticProperty : 'static property of B' ,
});
var instance = new B( 'value' );
alert(instance.getProperty());
alert(instance.getStaticProperty());
alert(B.staticProperty);
* This source code was highlighted with Source Code Highlighter .
The plugin itself can be downloaded from here .Source: https://habr.com/ru/post/57380/
All Articles