This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I need detailed explanation of difference between compile time polymorphism and run time polymorphism?. How complie time polymorphism and run time polymorphism is achieved. Can any body explain with detailed example.
There is no anology like compile time polymorphism, polymorphism only happen run time. Try this: 1] create a class, declare one method in it. 2] create another class that extends previous one and override that method. 3] write main method in second class, and in that, assign sub class object to super class reference. 4] call that method.
what happens, at compile time, it is binded to reference and at run time it is binded to object and thatswhy the overriding method gets execute.
//output is: test() is overriding method But my doubt is: deciding which method to be called during compile time is compile time polymorphism. ex: Sub ob = new Sub(); //This is example for compile time polymorphism.
Deciding which method to be called at runtime is runtime polymorphism. Super ob = new Sub();//Example for runtime polymorphism.Thanks for spending your most valuable time for giving response.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Complie time polymorphism vs Runtime polymorphism