Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Polymorphic Bean reference and Java polymorphism

 
Rajat Sharmanaive
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi

I posted this mistakenly at a wrong forum. Hope to get some help this time. Learning through HFSJ by K&B. Following is my query from the same.

The jsp standard action:
In the generated servlet, translates to:

Following are my 2 beans:

But i notice that the reference variable personBean which is of the superclass type is able to access (and set) the subclass bean functions like setEmpId() which are not overridden. From previous knowledge I understand that dynamic dispatch happens only for overridden functions. Is eveything fine here. Please throw some light.

Sincerely hoping this time I have posted it correctly
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once. This topic is closed.
 
    Bookmark Topic Watch Topic
  • New Topic