What will be the result of calling the function with the following parameters separated by comma?
#include <iostream>

class A
{
public:
   int field;

   A(void) : field(1) {}
   A(int)  : field(0) {}
};

void func(A value)
{
   std::cout << value.field;
}

void * fvoid()
{
   return 0;
}

int main(int argc, char * argv[])
{
   func(( fvoid() , 5 ));
}
Explanation
At first, comma operation is performed, and then the last value will be passed into the constructor A(int).

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes