Object Oriented Programming - Find Output

11. The following program
void abc (int &p)
{
cout  << p ;
}
void main (void)
{
float m = 1.23;
abc (m) ;
cout << m;
}    

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


12. What is the output of the following c++ program?
void abc (int x = 0, int y = 0)
{
cout << "Hi There";
}
void abc (int x)
{
cout  << "How are you doing today ? " ;
}
void main (void)
(
int m = 5;
abc (m) ;
}    

  • Option : D
  • Explanation : The call abc ( ) matches with the signatures - void abc (int x = 0, int y = 0) and void abc (int x). The compiler cannot unambiguously resolve this conflict. So it complains.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *