struct Foo
{
void SayHello()
{
std::cout << "Hi, I am Foo";
}
};
I have the above given struct. I have seen a usage like this in one of our code base.
Foo foo;
{
foo.SayHello();
}
IMO, It does same like
Foo foo;
foo.SayHello();
Or is there any advantage/difference for the first method?
Any thoughts?