Object Orientation

Moderators: None (Apply to moderate this forum)
Number of threads: 46
Number of posts: 78

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Polymorphisim in Java Posted by jgaleamt on 28 Nov 2002 at 8:28 PM
I have just started java and have some problems with understanding polymorphisim
if anyone out there can help me pls send along
code examples are mostly appreciated
Thanks
Report
Re: Polymorphisim in Java Posted by vaibhavdesai on 28 Nov 2002 at 10:00 PM
This message was edited by vaibhavdesai at 2002-11-28 22:3:37

hi
First of all one thing understand that polymorphism is not many functions with same name and different parameters. and the type of function invoked depends on type of parameters, tat is function overloading. Infact polymorphism is more linked with inheritance. Assume there is parent class and base class inherits parent class. And there is function in both classes with same name even same parameters. but the type of function invoked is decided at runtime by the type of object. if the object is of base class then the function of base class will be called and if the object is of parent class then the parent class object will be called. Check out this link for polymorphism. It is in C++ but has nice explanation.
http://trinetra.ncb.ernet.in/~manu/cplusplus/cplusplus14.html

cheers
vaibhav







 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.