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
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
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 10:56 AM.
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...
Hay harisudhan, your question is already answered earlier in this forum.
Please check that here
http://www.geekinterview.com/talk/50...erloading.html
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.
-sutnarcha-
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}
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.