write a program for function overloading?

Answer Posted / narmadha

same function name with multiple definitions

#include <iostream.h>
void print(int i)
{
cout << " int " << i << endl;
}
void print(double f)
{
cout << " float " << f << endl;
}
void print(char* c)
{
cout << " char " << c << endl;
}
int main()
{
print(10);
print(10.10);
print("a");
return 0;
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

2212


What is the benefit of oop?

770


What is super in oop?

828


Are polymorphisms mutations?

888


What is the problem with multiple inheritance?

821


What is difference between pop and oop?

809


Why do we use oop?

823


Which language is pure oop?

748


What are the benefits of interface?

800


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).

1891


What is encapsulation c#?

807


What are the 4 main oop principles?

942


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1870


What is abstraction example?

829


What is pure oop?

845