what's the pure virtual function?what's the constructor function?
public abstract class AmAbstract
{
private String name;
public AmAbstract(){
}
public AmAbstract(String name){
}
}
what's the pure virtual function?what's the constructor function?
public abstract class AmAbstract
{
private String name;
public AmAbstract(){
}
public AmAbstract(String name){
}
}
The constructors of concrete sub-classes of an abstract class still have to invoke the constructor of their super-class, even when its abstract.
That said, there is no reason for the abstract class constructor to have public
access. protected
access is sufficient.
public class Concrete extends AmAbstract
{
public Concrete () {
super (); // invoke the constructor of the abstract class
}
public Concrete (String name){
super (name); // invoke the constructor of the abstract class
}
}