What will be the output of below C++ Program?
class Gfg
{ public :
int main( int s)
{
cout << s << ", " ;
return 0;
}
int main( char *s)
{
cout << s << “, ”;
return 0;
}
int main( int s , int m)
{
cout << s << " " << m;
return 0;
}
}; int main()
{ Gfg obj;
obj.main(3);
obj.main("Hello World!");
obj.main(9, 6);
return 0;
} |
(A) 3
(B) Error
(C) 3, Hello World!, 9 6
(D) 3, Garbage Value, 9 6
Answer: (C)
Explanation: https://www.geeksforgeeks.org/can-main-overloaded-c/amp/
Quiz of this Question
Article Tags :
Recommended Articles