posted 24 years ago
When you explicitly construct a constructor for any class, the default no-args constructor ceases to exist. There is absolutely no problem as long as yur constructor is not overloaded.
In your program, you have a super class and a sub class. You have an overloaded constructor in the superclass. SO the no-args constructor ceases to exist. When you create an instance of the sub-class, the constructor call is down the hierarchy, (ie) super to sub class.
The compiler always looks for the no-args constructor in the super class unless you have EXPLICITLY told the compiler which constructor of the super class it shud call.
Try calling the corresponding super class constructor in the sub class const. using super(args) and yu will have no problem at all. Else give a no-args constructor to the super class and the code will compile.
To put it short, when instantiating a sub class object, the constructors are called from super class downwards and unless you make a call to a particular cons. of the super class, by default the compiler runs to the no-args constructor of super class.
Hope that helped.
--Vasanth