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).

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты