Thread: friend question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    friend question

    i want to make class A friend of class B, so when i declare an instance of A within B its private members will also in handy. but things go wrongly when i compile it, my code is right below:
    Code:
    template <class T>
    class A
    {
    	friend B<T>;
    	public:
    		//
    	private:
    		T data;
    };
    template <class T>
    class B
    {
    	public :
    		//
    	private:
    		A<T>* a;
    }
    i just can not figure out the problem, any ideas ?

    btw, i am with Dev-C++ 5, thanx.
    Last edited by black; 08-02-2004 at 03:05 AM.
    Never end on learning~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Noob question about a use a friend class
    By dorenthe in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 12:38 PM
  2. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  3. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM
  4. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  5. inline friend functions.
    By sean in forum C++ Programming
    Replies: 2
    Last Post: 01-03-2002, 12:37 PM