I suddenly thought of this, i.e. how ctors really work..
They are forbidden from having return types:
--Then how does the following code work?
Code:
class X
{
public:
X(int){};
};
int main()
{
X x(4);
x = X(47); //Assuming that = is well defined or the default works
return 0;
}
Would it be correct to assume that the compiler(or at least some of them) implement constructors so that they 'return' the constructed object ?
Can anyone point me to a document that has some evidence on it or says that it is false?
*I got hold of the gcc/g++ sources but have no idea how to look for the needle within the hay ...and the readme's are not very explicit