Inheritance problem
%u
unknown at unknown.com
Fri Feb 11 12:40:18 PST 2011
Hello,
I've a problem with my class inheritance. I have class called Texture
which implements the interface IDrawable and the abstract class
APickable.
The Texture-class contains 3 members which looks like this:
GLuint pTextureID;
Size pSize1, pSize2;
Finally... my Texture-class looks like:
class Texture : APickable, IDrawable {
protected {
GLuint pTextureID;
Size pSize, pAnoutherSize;
}
}
now... I have a second class called Animation which looks like this:
class Animation : Texture {
private {
Texture[] pFrames;
}
public {
this(string file, string[] paths...) {
super(file);
pFrames ~= this;
foreach(string cur; paths) {
pFrames ~= new Texture(cur);
}
}
Size getSize() {
return pFrames[0].pSize;
}
}
}
As I know, pFrames[0].pSize can be called... pSize in the Texture-
class is marked as protected, but I get the following error:
Error: class Texture member pSize is not accessible.
When I mark the protected members of the Texture-class as public, it
works (should be clear), but why do I get this error when mark them
as protected?
I hope anyone can help to solve the problem.
More information about the Digitalmars-d-learn
mailing list