フレンドとテンプレート

C++テンプレートを含める場合、 クラスとそれらのフレンドとの間には 4 種類の関係があります。

次の例は、これらの関係を示しています。

class B{
   template<class V> friend int j();
}
 
template<class S> g();
 
template<class T> class A {
   friend int e();
   friend int f(T);
   friend int g<T>();
   template<class U> friend int h();
};

これらの関係は、フレンド・クラスにも適用します。

関連参照

IBM Copyright 2003