No, you canβt.
What you propose is field shading - you cannot override a field.
The name field in the subclass has nothing to do with the name field in the superclass, except that it has the same name "name" and, thus, selects the field in the superclass, one should refer to it as super.name in the subclass.
In general, this is considered a βmistakeβ (or a potential mistake), and best practices are not shadow fields, because it is so easy to access the wrong field without knowing it.
source share