Is Constructor Overriding Possible?

后端 未结 14 1945
时光说笑
时光说笑 2020-12-08 00:31

What i know is, the compiler writes a default no argument constructor in the byte code. But if we write it ourselves, that constructor is called automatically. Is this pheno

14条回答
  •  再見小時候
    2020-12-08 01:21

    Constructor overriding is not possible because of following reason.

    Constructor name must be the same name of class name. In Inheritance practice you need to create two classes with different names hence two constructors must have different names. So constructor overriding is not possible and that thought not even make sense.

提交回复
热议问题