Function Overloading
void SetAString(const char* val) {m_someString = val;}
void SetAString(const std::string& val) {m_someString = val;}
etc..
the functions are distiguinished based on the parameters.
Function Overiding
class B
{
virtual void SaySomething(){::MessageBox(NULL, "HELLO", NULL, MB_OK);}
}
class A : public class B
{
virtual void SaySomething(){::MessageBox(NULL, "NO", NULL, MB_OK);}
}
the result of calling SaySomething depends on the subtype of
the object.
**********
Vasu M
**********
2006-12-04 17:18:24
·
answer #1
·
answered by V@su Maniram 3
·
1⤊
0⤋
It happens only with a Object Orientted Language.
If the Polymorphism or a Function is defined in a Single Class for many times, then Itz Overloading .
If u r Writing the Same Function in Two different classes and inheriting bothof them, then itz Overriding.
Usually, overriding happens in Inheritance of Two or Classes.
2006-12-03 21:42:23
·
answer #2
·
answered by Ravi Nanjunda Rao 3
·
0⤊
0⤋
If you override a function, the new function you have written will override the old function, making the old function "disappear".
If you overload a function, you add an additional function with the same name, but which takes different arguments. The old and new functions are both available.
Rawlyn.
2006-12-03 21:03:09
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
Create an Object define the Function foo(int I ) which returns I+I , You can define another function Foo(string s) Which return s +s. That is overloading
Function overloading is Function with same name but different number or types of arguments.
In the descendent object if you redefine the Foo((int I ) as I *I you are overriding the function.
Overriding means you are redefining a function in the descendent object.
2006-12-04 06:42:04
·
answer #4
·
answered by raju 5
·
0⤊
0⤋
They are two totally different concepts. Overloading means that you can
have several different functions with the same name.
Overriding means that out of several functions, the 'right' one is selected
at run-type depending on the dynamic type of an object.
Overloading refers to the selection of multiple signatures of functions
of the same name:
A(int x);
A(std::string s);
A(double d);
is overloading the function name A.
Overriding refers to functions that have the same signature as a
virtual function in the base class:
class B {
virtual void V();
};
class D : public B {
viod V();
};
D::V overrides B::V.
2006-12-03 20:20:20
·
answer #5
·
answered by abhi 2
·
0⤊
0⤋
OverLoading thats advise the function have the comparable call yet deferent style of parameters or types, overridin advise the comparable functtion that inhertes from the backside classification you may reimplement the function with deferent functionalty, by employing employing the comparable call in the backside classification Regard's
2016-10-13 23:27:57
·
answer #6
·
answered by ? 4
·
0⤊
0⤋
hi ...
overloading is that in which change the type of arguments and return types in overridding u give the same prototype.....
2006-12-03 20:37:27
·
answer #7
·
answered by komma s 1
·
0⤊
0⤋