michael@0: michael@0: function Foo(x) michael@0: { michael@0: this.f = x + 10; michael@0: } michael@0: michael@0: function Bar() michael@0: { michael@0: this.g = 0; michael@0: } michael@0: michael@0: Bar.prototype = Foo.prototype; michael@0: michael@0: var x = new Foo(0); michael@0: var y = new Bar(); michael@0: michael@0: assertEq(10, eval("x.f")); michael@0: assertEq(undefined, eval("y.f")); michael@0: michael@0: function Other(x) michael@0: { michael@0: this.f = x + 10; michael@0: } michael@0: michael@0: var a = new Other(0); michael@0: var b = Object.create(Other.prototype); michael@0: michael@0: assertEq(10, eval("a.f")); michael@0: assertEq(undefined, eval("b.f"));