Accessing super class function using subclass object

前端 未结 5 1439
庸人自扰
庸人自扰 2021-01-18 22:08

I have an object of a subclass extending its superclass. There is an overridden method in subclass which can be called using the object. Is that possible to call the superc

5条回答
  •  梦毁少年i
    2021-01-18 23:06

    No, it's not possible, and if you think you need it, rethink your design. The whole point of overriding a method is to replace its functionality. If a different class knows that much about that class's internal workings, you're completely killing encapsulation.

提交回复
热议问题