2
Overloading and Overriding? View(s): 38739 W hat is diff erence bet ween overloadin g and overriding? Answer 1) Overloading and O verr iding both are exam ple of polym orphism. Overriding is dynam ic polymorphismwhile overloading is static polym orphism. In other words, Overloading is evaluated at compile tim e whereas Overriding is evaluated at Run T im e. Overriding: Overriding is a changing of behavior of a class in drive class using dynamic polymorphism. For example in C# you have a class A and another class B derives fromA. C lass A have a virtual method abc and in class B using overr ide you given new functionality to this m ethod. Overloading:  Overloading is a m echanismby which we can have two or m ore dif f erent me thods using same nam e. Overloading can be implemented using different parameter data types, different number of parameters, and different order of parameters.  Asked in : Mahindra Satyam Exp ertise Level: Beginner Last updated on Tuesday, 05 July 2011 4/5 stars (45 vote(s))  Copyright © 2009 - 2012 mr-ponna.com

Overloading and Overriding

Embed Size (px)

Citation preview

Page 1: Overloading and Overriding

7/23/2019 Overloading and Overriding

http://slidepdf.com/reader/full/overloading-and-overriding 1/1

Overloading and Overriding?View(s):

38739

What is difference between overloading and overriding?

Answer 1)

Overloading and Overriding both are example of polymorphism. Overriding is dynamic polymorphismwhile overloading is static polymorphism.

In other words, Overloading is evaluated at compile time whereas Overriding is evaluated at Run Time.

Overriding: Overriding is a changing of behavior of a class in drive class using dynamic polymorphism. For example in C# you have a class A and another class B derives fromA.

Class A have a virtual method abc and in class B using override you given new functionality to this method.

Overloading: Overloading is a mechanismby which we can have two or more different methods using same name.

Overloading can be implemented using different parameter data types, different number of parameters, and different order of parameters.

  Asked in: Mahindra Satyam Expertise Level: Beginner

Last updated on Tuesday, 05 July 2011

4/5 stars (45 vote(s))

 

Copyright © 2009 - 2012 mr-ponna.com