== Auszug aus Steven Schveighoffer ([email protected])'s Artikel > On Fri, 11 Feb 2011 16:14:31 -0500, %u <[email protected]> wrote: > > == Auszug aus Steven Schveighoffer ([email protected])'s Artikel > > > > Thanks, but what about the following: > > > > import std.stdio : writeln; > > > > class a { > > > > public this(int v) { > > myVar = v; > > } > > > > protected int myVar; > > > > } > > > > class b : a { > > > > private a[] moreInstances; > > > > this(int v, int[] vars...) { > > super(v); > > moreInstances ~= this; > > > > foreach(int cur; vars) { > > moreInstances ~= new a(cur); > > } > > } > > > > int getVar() { > > return moreInstances[1].myVar; > > } > > > > } > > > > void main(string[] args) { > > b exp = new b(0, 1, 2); > > writeln(exp.getVar()); > > } > > > > This compiles fine and prints the number 1. myVar is also protected > > in class a, I also call myVar in the getVar()-method of class b. > Any code can access any members defined in the current module, regardless > of access attributes (that rule is outlined in the link I sent, I just > didn't quote that part). You have to split this into multiple modules to > see the other rules take effect. > -Steve
Ah, okay... this means I have to Texture and Animation into one module. Thanks a lot!
