Any way to _not_ call superclass constructor in Java?

后端 未结 13 1362
误落风尘
误落风尘 2020-12-15 04:16

If I have a class:

class A {
   public A() { }
}

and another

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

is t

13条回答
  •  时光取名叫无心
    2020-12-15 04:27

    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...

提交回复
热议问题