extending with unspecified constructor
I want to extend some class that has multiple constructors with different arguments. however i don't intend to do anything with the arguments in my code.
Is there a way to extend a constructer in such a way
public class(<any arguments>)
{
super(<any arguments>);
mycode();
}
void mycode()
......
without spezifieing what <any arguments> is.
[433 byte] By [
arcosh] at [2007-9-26 1:39:57]

For all practical purposes statusquo is right. From a theorietical point of you, you could write a constructor that takes an array of objects (as Java does not have variable parameters), then use reflection to invoke the appropriate constructor.
> For all practical purposes statusquo is right.
>
> From a theorietical point of you, you could write a
> constructor that takes an array of objects (as Java
> does not have variable parameters), then use
> reflection to invoke the appropriate constructor.
this won't work because super is supposed to be the first call in a constructor, if there is one, and one is required.
Well, yes, but why do you have to? If the subclass doesn't have clients that need that constructor, then you don't have to add it.
>It just gets very boring if i add an additional constuctor to the
>extended classand then have to go through all the extending classes
How many constructors do you have? Probably more than 5 suggests something is wrong with the design of the class.
If you are doing is simply to provide default arguments then I would suggest defining a primitive class that contains nothing but public attributes and a single default ctor. The ctor defines the standard definitions. A caller redefines the attributes they want to. Your main classes have a single ctor which takes the primitive as the only argument.