book
=
function(name,count) {
/*
instance property
*/
this
._pageCount
=
count;
/*
closure start
*/
var _name
=
name;
//
private member
/*
instance method
*/
this
.getName
=
function() {
return
_name; }
/*
closure end
*/
/*
private static member
*/
_type
=
"
class
"
; }
/*
public static member
*/
book.className
=
"
book
"
;
/*
prototype method
*/
book.prototype.getCount
=
function() {
return
this
._pageCount; };
//
static method
book.getType
=
function() {
//
访问静态的私有变量
return
_type; } book.getClassName
=
function() {
//
访问静态公有访问
return
this
.className; }
转载于:https://www.cnblogs.com/hjf1223/archive/2006/12/08/586349.html