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

How is polymorphism achieved?

578


Why oops is important?

599


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1662


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

1982


What are the 5 oop principles?

594






What is a function in oop?

625


What is destructor give example?

595


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

938


Advantage and disadvantage of routing in telecom sector

780


Write a c++ program to display pass and fail for three student using static member function

2807


What is encapsulation c#?

598


What are the benefits of polymorphism?

616


What are the benefits of oop?

600


What are oops methods?

562


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

1689