Does a default constructor call the baseclass constructor?
satya - 11/3/2013 7:31:54 AM
Does a default constructor call the baseclass constructor?
Does a default constructor call the baseclass constructor?
Search for: Does a default constructor call the baseclass constructor?
satya - 11/3/2013 7:34:01 AM
In Java Does a default constructor call the baseclass constructor?
In Java Does a default constructor call the baseclass constructor?
Search for: In Java Does a default constructor call the baseclass constructor?
satya - 11/3/2013 7:38:44 AM
I guess a few rules
satya - 11/3/2013 7:41:20 AM
So there is no need to do this
SomeClass
{
public SomeClass(someargs)
{
super(); //this is implied
//do something with someargs
}
public SomeClass()
{
super(); //this is automatic, no need to do this
}
}
satya - 11/3/2013 7:44:44 AM
An interesting implication which the compiler will tell you anyways...
Because the super class default constructor is automatically added, if the base class defines a non default constructor and does not define a default constructor then it will be an error.