C++/What is method Overriding in OOPs
I am kedar desai from india.....maharashtra....
i am learning in S.Y.IT i had some difficulty about the overriding So, can u tell me the exact deffination,it's features and the advantage and disadvantage of the method overriding?
ANSWER: Please also have a look at: http://en.allexperts.com/q/C-1040/Difference-Overriding-Overloading-1.htm
If this does not clear your doubt, get back to me with more details of what exactly you didn't understand.
---------- FOLLOW-UP ----------
QUESTION: i got the concept of the overriding, bt still i am confused. because i heard that overriding is a part of inheritance from some sites and i heard that overridind is part of polymorphism plz sir tell me is this right if these both are right then what is the difference between these two?
Overriding means a derived class member overrides the behavior of the base class. So it is applicable to polymorphism i.e. overriding is applicable when the base class function (that is overriden in the derived class) is virtual. If the base class function() - where function() is present in both Base and Derived classes - is not virtual, the call to ptrBase->function() would not call Derived::function() but Base::function() - You would have to use ptrDerived->function() to call Derived::function() - this would not be a case of overriding.
This same thing is the topic of discussion at http://en.allexperts.com/q/C-1040/Difference-Overriding-Overloading-1.htm
Hope this helps!