Can you inherit from a private class?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at the Consultative Group for International Agricultural Research, Lives in Montpellier, France.
Functionally, it's not inherited. But ideally, it is. A subclass does not inherit the private members of its parent class. However, if the superclass has public or protected methods for accessing its private fields, these can also be used by the subclass.
2023-05-15 12:30:24
评论(499)
Helpful(122)
Helpful
Helpful(2)

Amelia Cooper
QuesHub.com delivers expert answers and knowledge to you.
Functionally, it's not inherited. But ideally, it is. A subclass does not inherit the private members of its parent class. However, if the superclass has public or protected methods for accessing its private fields, these can also be used by the subclass.