Subj : Re: Private Data and Prototype Inheritance To : Kevin Lindsey From : Brendan Eich Date : Fri Jan 09 2004 01:33 pm Kevin Lindsey wrote: > but cannot do this: > > var fancyLine = new FancyLine(); > fancyLine.x1 = 10.0; > fancyLine.y1 = 10.0; > > even though the FancyLine example results in calls to Line's setProperty > function with reference to the fancyLine object (which previously did have > private data attached to it). You can't delegate method calls from an object lacking private data to one having private data, unless the prototype's getter/setter use the prototype's privates, which would in general make a pigeon-hole problem (only one prototype, many delegating instances). You could wrap, instead, but then you have to make a Line for every FancyLine. Alternatively, you could avoid private data and use property storage. Then delegation works as usual. /be .