What is the error in this file?
I get:
foo2.cpp:9: error: expected primary-expression before '(' token
foo2.cpp:9: error: expected primary-expression before 'int'
foo2.cpp:9: error: expected ';' before '{' token
int main(void)
{
class X {
int i;
public:
X(int ii = 0);
};
X::X(int ii) { i = ii; }
return 0;
}
First, may I ask, WHY?
Second, you can’t provide an implementation inside a method (including
main). If you must do this, keep the implementation inline: