Hello Can any body tell me what is the difference between Overloading and Overriding in C++ ?? Thanks in Advance...... Deepak
overloading is giving an operator meaning which is needed for us i mean the operator can do the job as we want if we overload but overriding is giving some diffrent meaning in to a function which specified in parent process in inheritance
Thats what you are saying about operator overloading. I dont see any similarity. Allows the creation of several functions with the same name which differ from each other in terms of the type of the input and the type of the output of the function. Overriding, is a feature that allows a subclass to provide a specific implementation of a method that is already provided by one of its superclasses. The implementation in the subclass overrides (replaces) the implementation in the superclass.
To add on to shabbir...overloading is the process of giving a particular operator another meaning. For eg. while using cout << "hello world"; Here "<<" does not have its actual meaning but is an output operator.This is a form or compile time polymorphism. The use of virtual functions is an example for overriding of functions in the subclasses.A form of run time polymorphism.
A virtual function in the base class does not override the derived function if the derived function exists, unless the call is ambiguous. A pure virtual function requires overriding in the derived class. An overloaded operator may give the operator another meaning (as in output versus shift), or it may have the same meaning (add, say) with the operation merely modified. Adding integers is not done in the same way as adding (concatenating) strings.