WHY FUCTION OVERLOADING DOSENOT RETURN A RETEN TYPE
Answer Posted / manjunathtek
Function overloading has a return type...
Ex:
#include<iostream>
using namespace std;
//Function 1:
int max(int a, int b)
{
return (a>b)? a:b;
}
//Function 2:
float max(float a, float b)
{
return(a>b)? a:b;
}
int main()
{
int c;
float d;
c=max(5,4); //will display 5
cout<<c<<endl;
d=max(3.14,6.15); //will display 6.15
cout<<d<<endl;
return 0;
}
Important Concepts in Fn. Overloading:
a) Fun Overloading depends upon the type/number/order in
which the arguments are passed...
b) Fun Overloading can take place for a function which is
within the same scope... (i.e.) both function 1:, and
Function 2: should be in the same { ...} (both the
functions are within main() (i.e. same scope)...
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
Which is better struts or spring?
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
What does and I oop and sksksk mean?
What do you mean by abstraction?
Can a destructor be called directly?
Prepare me a program for the animation of train
What is abstraction encapsulation?
What is oops?what is its use in software engineering?
Why is polymorphism used?
write knight tour problem which is present in datastructure
Write a c++ program to display pass and fail for three student using static member function
#include
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
What is polymorphism oop?