write a program for function overloading?

Answer Posted / riks

#include<iiostream.h>
class overload
{
public:
int sum(int,int);
float sum(float,float);
};
int overload::sum(int num1,int num2)
{
return num1 + num2;
}
}
float overload::sum(float num1,float num2)
{
return num1+ num2
}
}
int main(90
{
overload o1;
cout<<"o1.sum(5.4f,8.6f)<<endl;
cout<<"o1.sum(19,34)<<endl;

Is This Answer Correct ?    39 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is oops with example?

564


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2575


Why do we use oop?

605


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1652


write a program that takes input in digits and display the result in words from 1 to 1000

1987






What is overloading and its types?

615


Why it is called runtime polymorphism?

575


Which is not an object oriented programming language?

539


What is overriding in oops?

602


What is an example of genetic polymorphism?

648


What is encapsulation c#?

600


Why is static class not inherited?

595


What is constructor overloading in oop?

607


What is byval and byref? What are differences between them?

1687


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

1618