I do not know why but this code works, what does this record }r;
and how it works ? can in this way be declared a global object class ?
#include <iostream>
class А
{
public:
А()
{
std::cout << "Hello World";
}
}r;
int main()
{
}
That declares a global variable named r
that is of type A
.
It's the same as
class A { ... };
A r;
int main() { ... }