Monday 26 April 2021

Function Parameter Matching and Overloading Qus - 7

 #include<iostream.h>

#include<conio.h>

void show(int a)

{

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

}

void show(double a)

{

cout<<"double - "<<a<<endl;

}

int main()

{

clrscr();

show(5);     //Exact Match

show('k');  //promotion

show(6.7);  //promotion

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

getch();

return 0;


}

No comments:

Post a Comment