Thread: compiling error
View Single Post
Old Oct 26th, 2006, 8:31 AM   #3
brad sue
Hobbyist Programmer
 
Join Date: Mar 2006
Posts: 115
Rep Power: 3 brad sue is on a distinguished road
Quote:
Originally Posted by The Dark View Post
Its basically saying that it doesn't know what a Screen object is, which means you haven't declared it yet. Try moving your definition of Screen to above the definition of the Rectangle:draw function (or maybe you need to include the header file - I can't tell from this snippet).
I tried what you have suggested me . Now
void Rectangle::draw( Screen  object)
     {   
          int x1=upLeft.getX();
          int y1=upLeft.getY();
          for(int i=x1;i<(x1+width);i++)
             for(int j=y1;j<(y1+height);j++)
                 object.pixels[x1][y1];
// pixels must be the private data member of the class Screen. 
it is a char pixels[4][5];
      }
the compiler gives me those errors:

`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.
brad sue is offline   Reply With Quote