资 源 简 介
This project is for class definition in JavaScript and it has below features:
clear private/public section partition
inheritance support
mixin support
Define class A
```
var A = $Class(function(){
// private section
var _name = null;
function _alert( msg ) {
alert( "A:> " + _name + " - " + msg );
}
// public section
return {
// public fields
msg: "",
// init function
init: function( name ) {
// init the private variable _name
_name = name;
},
hi: function( msg ) {
this.msg = msg;
_alert( this.msg );
}
}
})
// create an instance of A
var a = new A( "a" ); // the init function will be invoked with name "a"
a.hi( "hello" );
var bTrue = ( a instanceof A ) // true
var publicMsg = a.msg; // access the public field msg
```
Inheritance Definition
De