Difference Between Static And Runtime Polymorphism


STATIC POLYMORPHISM:

Static polymorphism is additionally called as compile-time polymorphism, which implies that we can make numerous methods in a program with the same name performing distinctive tasks. However, it gives the client or the software engineer the office and better comprehensibility of code.

RUNTIME POLYMORPHISM

This is otherwise called Dynamic Method Dispatch. Dynamic polymorphism is a procedure in which a call to an overridden method is settled at runtime, which is the reason it is called runtime polymorphism.

 

DIFFERENCE BETWEEN STATIC POLYMORPHISM AND RUNTIME POLYMORPHISM

  1. In Compile time Polymorphism, the call is settled by the compiler, whereas; In Run time Polymorphism, the call isn’t settled by the compiler.
  2. It is otherwise called as Compile-time Polymorphism and Early binding, whereas; it is otherwise called Dynamic binding, Late binding and overriding also.
  3. Overloading is compile-time polymorphism where more than one functions share a similar name with various parameters or signature and distinctive return type, whereas; Overriding is run time polymorphism having the same function with same parameters or mark, however, related in a class and its subclass.
  4. Static polymorphism is accomplished by function overloading and method overloading, whereas; Runtime polymorphism is accomplished by pointers and virtual functions.
  5. As in static polymorphism, it is analyzed early at compile time so it provides fast execution, whereas; Runtime polymorphism is slow because it is analyzed at the runtime.
  6. In Static polymorphism, all the stuff is managed and executed at compile time which makes it less flexible, whereas; Runtime polymorphism is more flexible because of its execution at runtime.

 

You would also like


Posted in Articles and tagged , , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *