Differentiate between function overloading and function overriding

前端 未结 11 1888
臣服心动
臣服心动 2020-11-29 18:40

Differentiate between function overloading and function overriding in C++?

11条回答
  •  死守一世寂寞
    2020-11-29 18:56

    1.Function Overloading is when multiple function with same name exist in a class. Function Overriding is when function have same prototype in base class as well as derived class.

    2.Function Overloading can occur without inheritance. Function Overriding occurs when one class is inherited from another class.

    3.Overloaded functions must differ in either number of parameters or type of parameters should be different. In Overridden function parameters must be same.

    For more detail you can visit below link where you get more information about function overloading and overriding in c++ https://googleweblight.com/i?u=https://www.geeksforgeeks.org/function-overloading-vs-function-overriding-in-cpp/&hl=en-IN

提交回复
热议问题