M
Michael Klatt
class Foo
{
public :
explicit Foo(int i) : m_int(i) {}
private :
int m_int;
};
Foo f(int i)
{
return i;
}
Foo g(int i);
{
return Foo(i);
}
int main()
{
f(2); // is a Foo ever constructed?
}
Will a Foo be constructed by the return statement in f() even if the
return value is ignored in the calling function or does the
constructor have to be explicitly called as in g()?
{
public :
explicit Foo(int i) : m_int(i) {}
private :
int m_int;
};
Foo f(int i)
{
return i;
}
Foo g(int i);
{
return Foo(i);
}
int main()
{
f(2); // is a Foo ever constructed?
}
Will a Foo be constructed by the return statement in f() even if the
return value is ignored in the calling function or does the
constructor have to be explicitly called as in g()?