Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

what is the deffrent between overloading and overriding?

user-image
Question added by Mahmoud Abdalla Mohamed Ismail ismail , Technical Support , Etisalat UAE
Date Posted: 2013/06/05

overloading is nothing but the method signature varies from class to class with same name,where in overriding method name and signature does not rloading is compile time polymorphism where as overriding is dynamic or run-time polymorphism.

Athanassios Staveris-Polykalas
by Athanassios Staveris-Polykalas , Secretary General of Telecommunications and Post - Hellenic Republic , General Secretariat of Telecommunications and Post - Hellenic Republic

hi i think giving an example might make it easier: overloading: two or more functions have the same name but take as input different parameters: void myFunction(int i); void myFunction(string a); void myFunction(float b); Function myFunction() is overloaded overriding you give different meaning in functions with the same name: class A: //base class { public virtual void C( ) {//do something A } } class B:A //derived class { public override void C( ) {//do something B} } hope the above helps a bit

charaf Moustakim
by charaf Moustakim , Project Manager , Morpho ( Safran group)

You overload a function name f by declaring more than one function with the name f in the same scope.
The declarations of f must differ from each other by the types and/or the number of arguments in the argument list.
Overriding - When a function of base class is re-defined in the derived eg.
base class { area(float a,float b); } derive class { float area(); }

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.