Introducing C++ for Scientists, Engineers and Mathematicians by Derek Capper

Introducing C++ for Scientists, Engineers and Mathematicians by Derek Capper

Author:Derek Capper [Capper, Derek]
Language: eng
Format: epub
Published: 2008-09-09T07:46:00+00:00


Notice that a member of a reference to an object is accessed in the same way as a member of an object. The formal argument, s, is a reference to a sphere object and hence no copy of this object is made by the translated_sphere() function. An example of how to invoke this function is given below.

The only sphere objects are si and s2. No temporary copies are made since the function works directly with s2.

Exercise

Modify the program you wrote for the exercise on page 210 so that it uses reference arguments to avoid unnecessary temporary copies of a sphere object.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.