CompuServe Thread

Temporary Objects

1 messages in this thread
#39847From: JAMES MORRISMar 1, 1994 10:10 PM
While experimenting with classes and SAS6.51 I noticed that when overriding the + operator and returning a temporary (on stack) instance of the class that the entire class is copied then the temporary instance is deleted. This seems to be a lot of overhead. Is there a syntax which would allow the temporary instance to be used without being copied? ex: declared as a friend of class zeta: zeta operator + (zeta& A,zeta&B) { zeta temp; temp.Add(A,B); return temp; }