Thread: compiling error
View Single Post
Old Oct 26th, 2006, 9:27 PM   #7
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 825
Rep Power: 4 The Dark is on a distinguished road
If you want class Rectangle to be a friend class to Screen, put
friend class Rectangle;
inside screen.
You will need to tell the compiler that Rectangle is a class before you try use it as a friend. This is called forward declaring. Put
class Rectangle;
before the Screen class declaration.

A better idea might be that the Rectangle class should be using the Screen class setPoint member function instead of jumping into the internals of the Screen class.

Also note that this line in setPoint
        pixels[i][j]='c';
Is setting the pixel to the constant 'c', not the value of the c parameter.
The Dark is online now   Reply With Quote