Having code:
struct B
{
int* a;
B(int value):a(new int(value))
{ }
B():a(nullptr){}
B(const B&);
}
B::B(const B& pattern)
{
}
I’m getting err msg:
‘Error 1 error C2533: ‘B::{ctor}’ : constructors not allowed a return type’
Any idea why?
P.S. I’m using VS 2010RC
You’re missing a semicolon after your
structdefinition.The error is correct, constructors have no return type. Because you’re missing a semicolon, that entire struct definition is seen as a return type for a function, as in:
Add your semicolon: