inheritance - What is the use of a sub class object being referred by a super class variable in java? -


this question has answer here:

suppose b extends a , have declaration a a=new b(); use of referencing sub class object super class variable?and fields , methods accessible object a((only child class methods , variables) or (from both child , parent class))?

thank u

the reason abstraction. idea don't need know every little tiny detail object. example, you're driving car. part, pedal on right makes go faster, pedal on left slows down, , big round thing in front of steers car. how happens isn't important driver (a.k.a. user) know, important details work in order car move.


Comments

Popular posts from this blog

python - cx_oracle unable to find Oracle Client -

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -