Quote:
Originally Posted by The Dark
If you want class Rectangle to be a friend class to Screen, put
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
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
Is setting the pixel to the constant 'c', not the value of the c parameter.
|
Thanks Dark,
but when I put
friend class rectangle in Screen, I get a linker error.
[Linker error] undefined reference to `Rectangle::~Rectangle()'
[Linker error] undefined reference to `Point::~Point()'
and the same error that before is not gone.