Thread: compiling error
View Single Post
Old Oct 23rd, 2006, 5:19 PM   #1
brad sue
Hobbyist Programmer
 
Join Date: Mar 2006
Posts: 120
Rep Power: 3 brad sue is on a distinguished road
compiling error

Hi,
I have a compiling error but I do not understand why:
I have 2 class Rectangle and Screen.
I have to code a function in class rectangle whose the prototype is:
void Rectangle::draw( Screen object)

Since the class Screen is the argument of the function, I set
friend class Screen in the public section of the class Rectangle.

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];//error 1 and 3
I have the following errors:
1-`object' has incomplete type
2-forward declaration of `struct Screen' // refer to line where I declared friend class Screen
3-invalid use of undefined type `struct Screen'


Please, can someone please tell me the problem?
B.
brad sue is offline   Reply With Quote