Java inheritance – instance variable override
•
Java
Why is the instance variable of a superclass not overridden in inheritance?
Solution
Because inheritance is to modify behavior Behaviors are exposed through methods, which is why they can be covered
A field is not a behavior, but a state You do not need to modify it, nor do you need to use the private methods of the superclass They are designed to allow superclasses to do their work
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码