I'm wondering if the following constructors are the same for C++:
class foo
{
public:
foo(void){};
...
}
and
class foo
{
public:
foo(void);
...
}
Do curly brackets matter for these two cases? Thanks much!
Answer
They're not same. {}
represents a regular function-body and makes the former function definition.
foo(void){}; // function definition
foo(void); // function declaration
No comments:
Post a Comment