+ 10
Could I use inheritance to call another class constracter
4 Antworten
+ 9
I realize yes we can use inherite
+ 4
Base class ctor is automatically called when you create object of derived class... But if you want to call it in another manner, use super();
+ 2
class A
{
A()
{
System.out.println("hello A's constructer");
}
}
class B extends A
{
public static void main(String args[])
{
A a = new A();
}
}
you can use like this. i think you mean this?
0
I think that we can use inheritence