Prepare for your Next Interview
This is a discussion on Confused about Overloading and OverRiding within the OOPS forums, part of the Software Development category; Tell what is exactly these words overloading overriding virtual pure virtual inheritance polymorphism and these are same or not overloading=polymorphism overriding=inheritance i am really confusion abt these...
|
|||
|
Confused about Overloading and OverRiding
Tell what is exactly these words overloading overriding virtual pure virtual inheritance polymorphism and these are same or not overloading=polymorphism overriding=inheritance i am really confusion abt these
|
| Sponsored Links |
|
|||
|
Re: Confused about Overloading and OverRiding
Hi,
Overriding and Overloading both are examples for polymorphism overloading is a static polymorphism and Overriding is a dynamic polymorphism. Overrideing: Same methods name with same signature in both base class and derived class. Overloading: Same methods name with diffrent signature in base class. Inheritance: Using the all the features of base class in derived class. Regards, hari prasad Last edited by hari.nattuva : 06-05-2007 at 11:56 AM. |
|
|||
|
Re: Confused about Overloading and OverRiding
hi ,
overriding and overloading both comes under polymorphism .. overriding comes under runtime(dynamic) polymorphism. overloading comes under compiletime (static) polymorphism.. in overriding the method name and signature is same but access modifier is same or wider than the base class acess modifier .. and if your throwing any exceptions the base class method throwing exception should be same or wider(means parent exception)than derived class throwing exception.. Overloading: In overloading method name is same but signature is different .. plz if u have any issues let me know... |
|
|||
|
Re: Confused about Overloading and OverRiding
Hay harisudhan, your question is already answered earlier in this forum.
Please check that here http://www.geekinterview.com/talk/50...erloading.html (Difference between method overriding and overloading)
__________________
Lack of WILL POWER has caused more failure than lack of INTELLIGENCE or ABILITY. -sutnarcha- |
|
|||
|
Re: Confused about Overloading and OverRiding
Let me give one example.
METHOD OVERLOADING class human( { void Hand(two paremeters){ Eating} void Hand(three parameters) { Writing } void Hand(Five parameters) { Fighting } METHOD OVERIDING class father { void Hand(5 parameters){ Smoking; } } class child extends father{ void Hand(5 parameters){ Drinking} |
|
|||
|
Re: Confused about Overloading and OverRiding
frend
there is two forms in polymorphism 1.early or static binding 2.dynamic or late binding basically binding means interface b/n functoncall n real function. in function overriding we use the concept of virtual function. means if we place virtual keyword before function in baseclass(we must write virtual function base class only)it becomes virtual to all the derived classes to it.that means it overrides the base class function that means it exicutes the function of derived class instead of base class. in this we write function of same type & arguments. if we pass differently it ignores it. where as in overloading we use the concept of static binding.that means it is fixed. we may not change. in this the no.of arguments & type are same,except function name. and it is in the same class.where as in function overriding we write same function definition in different . i don't know how i can explain u. but if u want more information please go through the book ASHOK N.KAMADHANE PEARSON PUBLISHERS it is easy in language and very lucid explanation. thank u REGARDS, SUHANA. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference between method overriding and overloading | nancyphilips | OOPS | 23 | 2 Weeks Ago 03:26 AM |
| confused | saumya | Mechanical Engineering | 7 | 11-22-2007 06:53 AM |
| Function overloading example | vicky19772003 | Java | 6 | 05-22-2007 10:43 AM |
| I am very confused What to do | Geek_Guest | Career Advice | 1 | 04-19-2007 06:44 AM |
| Operator Overloading | sripri | C and C++ | 2 | 12-11-2006 10:12 AM |