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.

Leaking:• Leaking occurs when data structure passes areference to an object which is supposed to beinternal to the outside• Leaking often happens by mistake.• Problem: Alias can be used to by-pass interfaceof data structure.list1array:next:arrayclass ArrayList {private int[ ] array;private int next;public int[ ] getElems( ){ return array; }…}13.05.13© A. Poetzsch-Heffter, TU Kaiserslautern10

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

Saved successfully!

Ooh no, something went wrong!