AM> Vector(double xx = 0, double yy = 0); // constructor
CC> Are two default values legal?
I guess it is
AM> Vector Vector::operator+(const Vector & V2) const
AM> {
AM> Vector add;
AM>
AM> add.x = x + V2.x;
AM> add.y = y + V2.y;
AM> return add;
AM> }
It wasn't working since I had comminted a mistake before, using new with
a wild integer. I guess the temporary storage area was full of garbage,
so temporary objects were crazy.
CC>String operator+(String& left, String& right) {
CC> String str;
CC> strcat(str.s, left.s); <- I guess here it should be strcpy
CC> strcat(str.s, right.s);
CC> str.getLength();
CC> return str;
CC>}
CC> I used the same type of temporary in the same type situation
CC> with no problems.
CC> return str;
CC> Returns the value of the 'str' object before it is deallocated.
I had used the operator+ as above, but latter I found it would be more
elegant to make it a member function
Alberto Monteiro
---
þ SLMR 2.1a þ Build my fear of what's out there (Metallica)
--- FMail/386 1.02
---------------
* Origin: CentroIn! +55-21-205-0281, 41 lines, 24h, RJ/Brazil (4:802/21)
|