what is real-time example of runtime polymorphism and
compile time polymorphism

Answer Posted / harish kumar

Run time polymorphism : function and Operator overloading is
a runtime polymarphism. Example:- Bank Account, savings and
current(here, account class is the base class, savings and
current account are derived classes, the objects of each are
created at run time)

compiler time polymorphism : virtual function is a compiler
time polymorphism. Example:- calculating area of square and
rectangle (different classes, square and rectangle have a
function called area() which takes different arguments (for
square only one argument and for rectangle two arguments-) )

Is This Answer Correct ?    11 Yes 55 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the requirement of thread in java?

619


What was java originally called?

512


What is the difference between size and length in java?

513


Why is sizeof not a function?

549


How garbage collection is done in java?

551






What is a databasemetadata?

551


why java uses class level type casting ?

2253


How many bytes is a char in java?

530


What are computer functions?

481


What is a boolean output?

523


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

535


Can you declare the main method as final?

527


Are arrays passed by reference in java?

490


What is the difference between keyword and identifier?

534


How is java hashmap implemented?

552