13.07.2015 Views

4. Object Structures, Aliasing, and Encapsulation

4. Object Structures, Aliasing, and Encapsulation

4. Object Structures, Aliasing, and Encapsulation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Desirable Aspects of <strong>Aliasing</strong>:• Consistent view to shared objects• Multiple cursors/iterators into object structures• Time <strong>and</strong> space efficiencyExamples:(Desirable aliasing)1. Address objects that capture the address of aperson or institution:- Several objects may reference an address A.- If A is modified, the referencing objects keepa consistent <strong>and</strong> up-to-date view.2. Consider a complex tree or graph structure:- The structure can be traversed byseveral iterators.- Cursors can point to nodes of current interest.3. Data structures can share objects (e.g. singlylinked lists):- avoids to copy data structures when they areenlarged or reduced in size;- saves a lot of memory space.13.05.13© A. Poetzsch-Heffter, TU Kaiserslautern6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!