简体   繁体   中英

how does inheritance work in java when a method in abstract class call a method that has been overriden?

class A is abstract and has methods aa and bb. class B extends A and overrides bb. method aa in A calls bb.

does it call class B bb or class A bb?

Ok I tried it out. It calls class B version of bb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM