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.
Scenarios in which references are exported (1-6):package inside;public class C extends outside.B {public void putReferences() {C c = new C();/*1*/ outside.B.c1 = c;/*2*/ outside.B.storeReference(c);/*3*/ outside.B.c3s = new C[]{c};/*4*/ calledByConfined();/*5*/ implementedInSubclass();/*6*/ throw new E();}public void implementedInSubclass(){}/*7*/ public static C f = new C();/*8*/ public static C m(){ return new C();}/*9*/ public static C[] fs= new C[]{new C()};/*10*/ public C() { }}public class E extends RuntimeException{}13.05.13© A. Poetzsch-Heffter, TU Kaiserslautern34