N
Neelesh
Hi all,
Probably this question is a result of not understanding something very
basic -
class X{ };
int main()
{
X(f);
}
This code compiles without a problem and the line X(f) constructs a new
object of name 'f'.
I always believed that the expression X(f) creates a new temporary of
type X from a previously existing object f. Atleast that is what is
done when I say
X(f) + X(f) // assuming + is overloaded and some f exists and there is
a constructor inside X which can take an object of type f.
So does X(f) mean different things in different contexts? Can it create
a new object 'f' of type X as shown in above example?
Neelesh
Probably this question is a result of not understanding something very
basic -
class X{ };
int main()
{
X(f);
}
This code compiles without a problem and the line X(f) constructs a new
object of name 'f'.
I always believed that the expression X(f) creates a new temporary of
type X from a previously existing object f. Atleast that is what is
done when I say
X(f) + X(f) // assuming + is overloaded and some f exists and there is
a constructor inside X which can take an object of type f.
So does X(f) mean different things in different contexts? Can it create
a new object 'f' of type X as shown in above example?
Neelesh