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

What is the fundamental idea of oop?

650


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6165


What are oops functions?

600


What is polymorphism and its types?

611


What is difference between oop and pop?

630






Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1158


What does I oop mean?

631


State what is encapsulation and friend function?

712


What is inheritance in oop?

616


What is variable example?

605


What do you mean by overloading?

597


Whats oop mean?

611


What is purpose of inheritance?

659


What do you mean by Encapsulation?

654


What is pointer in oop?

549