• Create Account

### #ActualKulSeran

Posted 21 December 2013 - 02:12 PM

You didn't grab a reference..

AI a1 = a1.Add(o1);

is making a copy.  While "add" returns a reference value, since a1 isn't also a reference value it will use the copy-constructor AI(const AI &other) to construct a copy called a1.

You want to do:

AI &a1 = a1.Add(o1);

to have a reference. Since that way, a1 is of the type "reference to an AI", and can hold the exact reference that "add" returned.

### #1KulSeran

Posted 21 December 2013 - 02:09 PM

You didn't grab a reference..

AI a1 = a1.Add(o1);

is making a copy.

You want to do:

AI &a1 = a1.Add(o1);

to have a reference.

PARTNERS