Private member functions

by Kyrylo Slatin

JavaScript

function pr (){
	console.log(this.a);
}

function C(p){
	this.a = p;
}

C.prototype.print = function(){
	pr.call(this);
}

setTimeout(function(){
	var a = new C(1);
	a.print();
	var b = new C(2);
	a.print();
	b.print();
});