|
From: Simon D. M. <di...@bi...> - 2000-12-12 13:10:17
|
> For example the ListItem class:
>
> function ListItem(text,value)
> {
> this.superClass = Label;
> this.superClass(text);
> this.value = value;
> ...
> }
> ListItem.prototype = new Label();
>
> Perfect, except for the fact that one object is wasted to set the
> prototype.
There's always the option of leaving out the last line if the extra
object is a problem.
It would only mean that if you made changes to Label.prototype at
runtime, it wouldn't affect ListItem.prototype
That could either be a good thing or a bad thing, depending what
you want.
I'm not sure what the problem with the extra objects is, but you
could make your extra objects identifiable by setting the ID:
ListItem.prototype = new Label('protoListItem');
SD
|