Hypothetically speaking, how could adding a protected variable in a superclass create an error in Java? -


just fun, i'm trying think of scenario in protected variable can cause compilation error. lets had class fruit , class apple inherits fruit.

and go ahead , add protected variable x in fruit, causing program no longer compile. happen if how, causing error?

x inherited apple without problems. able use inside either fruit or apple. might decide override and/or implement setter and/or getter.


Comments

Popular posts from this blog

c# - Class in a list -

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

Jdbc Odbc Driver error -