Computing.Net > Forums > Programming > Difference Overloading Overiding..

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Difference Overloading Overiding..

Reply to Message Icon

Name: gardenair
Date: September 26, 2003 at 20:03:11 Pacific
OS: win98
CPU/Ram: 900
Comment:

Can any body tell me in detail that what is the difference between Function Overloading & Function Overriding in C Language.
Thnaks in advance..



Sponsored Link
Ads by Google

Response Number 1
Name: anonproxy
Date: September 26, 2003 at 20:54:15 Pacific
Reply:

These are both concepts of OOP and inheritence in particular.

Function overloading is about convenience in a strongly typed language (C/C++). Obviously your functions have defined data types associated with them. Well, sometimes you want to have the same function with different data types. So rather than name different functions (which share the same process, only have different data types), you name one function and provide it different data types. Also, the number of arguments can be changed. This all simplifies programming.

This explains it:
http://cplus.about.com/library/weekly/aa061602a.htm

A method is a function, which carries with it data types. A base is the root or parent class. A derived class is also referred to as a subclass.

Overriding a function comes into play when you have a base class and a derived class. You can call this a class and subclass. The subclass can call a new function, with an old name, to override the parent's function (which is said to have been shadowed), adding a new method and data type(s). This saves you from adding new methods and data types at the root of logical structures. Obiviously not every subclass may need that particular method and data type (or perhaps most use the original method), so rather than add it to the parent (thus casting it on the whole tree, unless you choose to forbid inheritance), you override the parent's original function with a new method and new data type, just for that subclass of course.

http://itm.blackpool.ac.uk/computing/Course_Webs/Bsc_Computing/oop/Inheritance/abstract_inher.html


0
Reply to Message Icon

Related Posts

See More


Discussion Board Frontpag... Keeping programs/OS's sep...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Difference Overloading Overiding..

overload override www.computing.net/answers/programming/overload-override/8364.html

C++ Overloading Operators www.computing.net/answers/programming/c-overloading-operators/11119.html

C++ operator== overload www.computing.net/answers/programming/c-operator-overload/4636.html