ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

what is the deffrent between overloading and overriding?

user-image
تم إضافة السؤال من قبل Mahmoud Abdalla Mohamed Ismail ismail , Technical Support , Etisalat UAE
تاريخ النشر: 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
من قبل 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
من قبل 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(); }

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟