Skip to content

Instantly share code, notes, and snippets.

@rainchen
Created November 14, 2009 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rainchen/234591 to your computer and use it in GitHub Desktop.
Save rainchen/234591 to your computer and use it in GitHub Desktop.
class1 = function() {
// private fields
var m_first = 1;
var m_second = 2;
// public attributes
this.p_3 = 3;
// private methods
function constructor() {
console.info(this.p_3);
method1();
method2();
}
function method1() {
alert(m_first);
}
var method2 = function() {
alert(m_second);
}
constructor();
// should be
//constructor.apply(this, arguments);
}
var o = new class1();
// error
alert(o.m_first);
o.method1();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment