Dynamic polymorphism:-(Runtime
polymorphism)
Methods
are binding to an object during runtime.
Method overriding:-
A class
can have a method which name is same as method name of it's base class
including same args,same data types and same return type(ie same signature).
Derived
class can modify the statements of its base class using overriding.
To
achieve dynamic polymorphism.
Dynamic method dispatch:-
An
object of a class can refer instance of itself and instance of it's derived
classes.
By
using this object, we can invoke
overridden methods only, because of it refers methods of its type, but
invokes methods of which instance has referred(assigned) now.
methods
are resolved(determined) at runtime.
No comments:
Post a Comment