Protected variables

Hi,

I’m new, a beginner, and learning both c++ and oF. Can anyone help me figure out how to access the “protected” variables of an oF class, like bpp of ofImage for example. I get compiler errors if I try to assign image.bpp to an int variable, or use it with cout. I vaguely remember that it might have been possible to do this back in oF 0.8.4. I’m using 0.9.3 now.

Thanks a bunch!

Tim

Hi TimChi,

Protected and Private variables are not accessible from outside the class, only Public.

If they are protected or private they are not intended to be modified directly, you should focus on the public interface only.

If you want to “cout” the value, then a way would be to subclass, as subclasses can access protected variables of the parent class.