Monday 26 April 2021

Function Parameter Matching and Overloading Qus - 6

 #include<iostream.h>

#include<conio.h>

void show(int a)

{

cout<<"int - "<<a<<endl;

}

void show(float a)

{

cout<<"float - "<<a<<endl;

}

int main()

{

clrscr();

show(5);     //Exact Match

show('k');  //promotion

//show(6.7);  //coversion - abmiguity (int, float)

show((float)6.7);

show((int)6.7);

//show();      //No Match - Error

getch();

return 0;


}

No comments:

Post a Comment