J
July
consider the following code:
class A {
public:
A(int i) : i(i) {
}
private:
int i;
};
int main()
{
A a;
return 0;
}
The code cannot compile because there is no default constructor of
class A, but the book says that "the compiler will generate the default
constructor if you don't define it"
What's wrong ?
class A {
public:
A(int i) : i(i) {
}
private:
int i;
};
int main()
{
A a;
return 0;
}
The code cannot compile because there is no default constructor of
class A, but the book says that "the compiler will generate the default
constructor if you don't define it"
What's wrong ?