Consider this:
class A {
public:
static A test(){
return A::A();
}
};
void main(){
A a = A::test();
}
And it compiles!
UPDATE NO.ONE
Ok, now let's edit this code a bit:
class A {
public:
static int test(){
return A::A();
}
};
void main(){
int a = A::test();
}
Does not compile and here is the error
error C2440: 'return' : cannot convert from 'A' to 'int'
I was taught all my life, that a constructor returns nothing! And it seems now, that it actually returns an object. I am completely blown away, please explain me, what is happening here