Results 1 to 7 of 7

Thread: friend classes?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Resolved friend classes?

    How in the hell can you use two classes inside each other in the
    same file?
    I could have sworn this used to work:
    Code:
    class cl1
    {
    	public:
    	int i;
    	cl1(cl2 c2){i = c2.i;}
    	friend class cl2;
    };
    
    // error: missing ')' before identifier c2
    
    class cl2
    {
    	public:
    	int i;
    	cl2(cl1 c1){i = c1.i;}
    	friend class cl1;
    };
    
    // this is fine
    Last edited by wey97; Nov 10th, 2004 at 09:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width