Question about Class

I have a problem about Class. See
1
2
3
4
5
6
7
Class A
{
public:
//copy constructor
A(A& );    //here, I dont know why it is 
A&
but not
A
//other ... }


eh,who can tell me why.
thank u
The value parameter A has to be copied, the reference parameter does not. The value parameter version assumes a copy constructor, which you are making.

In other words, for A(A) to work, A(A) has to already exist. This is because A(A) says "pass me a copy of A".
Here is a detailed explanation on arguments passed by reference: http://www.cplusplus.com/doc/tutorial/functions2/
Topic archived. No new replies allowed.