If I have a class
class Foo
{
public:
Foo();
Foo(int bar);
private:
int m_bar;
}
What is the difference between these two ways to initialize it's member
Foo::Foo(int bar):
m_bar(bar)
{
}
Foo::Foo(int bar):
m_bar{ bar }
{
}
I was told on a code review to use Uniform Initialization Syntax, i.e. brace initialization. Is there a difference in this case? Or is it just a style preference?
Aucun commentaire:
Enregistrer un commentaire