Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 23rd, 2006, 6: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
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post