Recently, I saw below code snippet in a project. I can't paste the project code directly but write a similar one instead. I can't understand why "fun(A{a});" can pass the compilation and works:(. Does anyone know such C++ feature? What does "A{a}" mean? Thanks very much!
class A {
public:
int x = 10;
int y = 20;
};
void fun(A a) {
cout << "A.x = " << a.x << endl;
cout << "A.y = " << a.y << endl;
}
int main() {
A a;
fun(A{a});
return 0;
}