Any way to _not_ call superclass constructor in Ja

2019-02-05 16:50发布

If I have a class:

class A {
   public A() { }
}

and another

class B extends A {
   public B() { }
}

is there any way to get B.B() not to call A.A()?

13条回答
别忘想泡老子
2楼-- · 2019-02-05 17:25

Nope - you cannot do it and why would you want to do it anyway? That would mess up your object model.

Anyways - i believe if you still want to do it and then you would have to manipulate the generated byte code.... there are a couple of libraries available that make it easy to instrument the byte code.

Strongly suggest against doing it...

查看更多
登录 后发表回答