{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Myy stdendl the same applies to template class

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: eturnPair.getFirst()+" returnPair: "+returnPair.getSecond()); } } C++ Parameter Variable is Pass by Value – Object Variables Point swapObject(Point a) int main(){ { // is an object value, the oint p (10,20); P // changes made are NOT visible std::cout << p.my_x() << " , " << // outside the func.on. p.my_y () < < s td::endl; int temp; temp=a.my_x(); //object “p” value is copied to the “a” a.set_x(a.my_y()); parameter variable a.set_y(temp); Point returnPoint=swapObject(p); Point localV(100,101); std::cout << p.my_x() << " , " << //return local object is ok as a copy of p.my_y() << std::endl; //the object reference is retu...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online