Ve array stl container iterator primive array is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rned std::cout << returnPoint.my_x() << " , return localV; " << returnPoint.my_y() << } std::endl; } The same applies to template class objects, such as vector<T> objects 2 10/2/12 C++ Objects Point int main() { X=10 p1 Point p1(10,10); Y=10 Point p2=p1; Point std::cout << p2.my_x() << " , " << X=100 p2.my_y(); Y=100 p2 p2.set_x(100); p2.set_y(100); • C compiler manipulates object itself for std::cout << p2.my_x() << " , " << computa.on. • This is NOT efficient. p2.my_y(); • Assignment operator (=) : copy the std::cout << p1.my_x() << " , " << en.re object value; p1.my_y(); • func.on passed the object argument by } copying the object value; • When an object is returned from a func.on, a copy of the object is returned. C++ Pass by reference using & Point swapObjec...
View Full Document

This document was uploaded on 03/06/2014 for the course CS 3710 at Memorial University.

Ask a homework question - tutors are online