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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example:(Alias modes as annotations)In programs, alias modes can be expressed bycomments/annotations tagging types:class LinkedList {private /* rep */ Entry header;private int size;}public void add( /* arg */ <strong>Object</strong> o ) {/* rep */ Entry newE =new /* rep */ Entry( o, header, header.previous );… }class Entry {private /* arg */ <strong>Object</strong> element;private Entry previous, next;public Entry( /* arg */ <strong>Object</strong> o, Entry p, Entry n ) { … }}13.05.13© A. Poetzsch-Heffter, TU Kaiserslautern26

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

Saved successfully!

Ooh no, something went wrong!