Thread: compiling error
View Single Post
Old Oct 26th, 2006, 5:33 PM   #5
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 850
Rep Power: 4 The Dark is on a distinguished road
Quote:
Originally Posted by brad sue View Post
`char Screen::pixels[4][5]' is private

I don't know why I have this error. it is like It cannot access it.
I tried to make friend class Rectangle in class Screen the I get a linker error.
Dont't know what to do here!
B.
That is what "private" means! It means only the Screen class can access the pixels member variable. Making Rectangle a friend class in Screen should get rid of the error, but may not be the best way to do things. As DaWei says, you need to post some more code.

Also note that
object.pixels[x1][y1];
Doesn't actually do anything.
The Dark is offline   Reply With Quote