friend11.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 32 行

C
32
字号
template <class T>class C;template <class T>struct S{  template <class U>  void f(U u)    {      C<U> cu;      cu.i = 3; // ERROR - S<double>::f<U> is a friend, but this is                //         S<int>::f<double>.     }};template <class T>class C{  template <class U>  friend void S<T>::f(U);  int i; // ERROR - private};int main(){  S<int> si;  si.f(3.0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?