tags:

views:

97

answers:

3

I've the below code,

template< typename T >
class T1 { 
public:
    T i;
protected:
    T j;
private:
    T k;
    friend void Test();
};

The above code has a template class T1 with three members i,j and k and a friend function Test(),

I just want to know that which member/s of T1 will be available in function Test()?

Any help in this regard will be highly appreciated.

+6  A: 

I just want to know that which member/s of T1 will be available in function Test()?

i,j and k

Prasoon Saurav
Aman Saleem
Yes.............
Prasoon Saurav
A: 

Everyone. If it's friend it's friend for good and bad.

There is nothing we can do
+5  A: 

All of them (i, j, k) will be available in function Test().

This is what "friend" gives you access to.

Benoît