Is this code both correct and canonical?
function foo( arg ) {
this.initialize ( arg );
}
foo.prototype.i nitialize=funct ion( arg ) {
// Initialize based on arg
}
function myFoo( arg ) {
this.initialize ( arg );
// Set other custom properties of myFoo
}
myFoo.prototype =new foo( '' ); // type of arg irrelevant here
myFoo.prototype .constructor=my Foo;
Basically I want to call the superclass constructor from the subclass'
constructor and then do some initialization of my own. In case it
helps, in C++ I would do something like
class B : public A {
B( int arg ) : A( arg ) {/*whatever*/}
};
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.