Function overloading can also be achieved if two or more functions differ only in their return types

Q.  Function overloading can also be achieved if two or more functions differ only in their return types.
- Published on 17 Jul 15

a. True
b. False

ANSWER: False
 

    Discussion

  • ramesh   -Posted on 09 Oct 15
    Function overloading is a process in which functions have same name but either the number of arguments or the data type of arguments has to be different. It does not depend upon the return type of functions because function will return a value when it is called.
    Example:
    class FuncOverloading
    {
      public:
      void sum(int x,int y)
    {
       cout << "\n Sum of two integers ::" << x+y;
    }

    void sum(double x,double y,double z)
    {
       cout << "\n Sum of three double variable ::" << x+y+z << endl;
    }
    };
      void main()
    {
       FuncOverloading obj;
       obj.sum(10,20);
       obj.sum(10.1,20.2,30.3);

    }

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)