Why are we not able to override an instance variable of a super class in a subclass?
Java – Overriding a super class’s instance variables
inheritancejava
Related Question
- Java – a serialVersionUID and why should I use it
- Java – How to initialise a static Map
- Java – Why do this() and super() have to be the first statement in a constructor
- Java – ‘Must Override a Superclass Method’ Errors after importing a project into Eclipse
- Java – Is List
a subclass of List ? Why are Java generics not implicitly polymorphic - Java – How do servlets work? Instantiation, sessions, shared variables and multithreading
- C# – Why not inherit from List
Best Solution
He perhaps meant to try and override the value used to initialize the variable. For example,
Instead of this (which is illegal)
One should do