Geeks Talk

Prepare for your Next Interview




Confused about Overloading and OverRiding

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...


Go Back   Geeks Talk > Software Development > OOPS

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 04-30-2007
Junior Member
 
Join Date: Apr 2007
Location: hyderabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
harisudhan is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-05-2007
Contributing Member
 
Join Date: May 2007
Location: bangalore
Posts: 65
Thanks: 3
Thanked 8 Times in 6 Posts
hari.nattuva is on a distinguished road
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.
Reply With Quote
  #3 (permalink)  
Old 06-05-2007
Junior Member
 
Join Date: Jun 2007
Location: USA
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Surekha venkat is on a distinguished road
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...
Reply With Quote
  #4 (permalink)  
Old 06-06-2007
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 523
Thanks: 1
Thanked 55 Times in 46 Posts
sutnarcha is on a distinguished road
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-
Reply With Quote
  #5 (permalink)  
Old 06-06-2007
Junior Member
 
Join Date: May 2007
Location: Mysore
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post
umeshap is on a distinguished road
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}
Reply With Quote
  #6 (permalink)  
Old 08-30-2008
Junior Member
 
Join Date: Jun 2008
Location: vijayawada
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
suhana is on a distinguished road
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.
Reply With Quote
Reply

  Geeks Talk > Software Development > OOPS


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 12:32 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved