4. Object Structures, Aliasing, and Encapsulation
4. Object Structures, Aliasing, and Encapsulation
4. Object Structures, Aliasing, and Encapsulation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3. Immutable objects must not depend on globalvariables:class Global {public static int a = 5;public static int getA(){return a;}}class Immutable2 {public int alwaysTheSame() {return Global.getA();}}Immutable2-objects are not immutable!The example demonstrates that mutability can depend on global state.13.05.13© A. Poetzsch-Heffter, TU Kaiserslautern16