class prototype object vs class instance properties

Garrett Smith dhtmlkitchen at gmail.com
Fri Aug 17 13:31:29 PDT 2007


What is the difference between a class's prototype object and it's
instance properties?

class A {
  var x : uint = 10; // instance property.
  prototype var x : uint = 20; // another instance property in the
prototype chain.
}

class B extends A { }

My understanding is that the result would be:

new B().x; // result is 20.

What would be the benefit of a class having a prototype over 9instance
properties/methods?



More information about the Es4-discuss mailing list