编程札记

模板类的提前声明:

template<typename type>
class Listnode;

友元模板类的声明:

friend class Listnode<listtype>;  //无需在前面加上 template

友元模板函数的声明:

template<typename type>
friend void function(type a);   //需要在前面加上 template

此外要记住哪个是哪个的友元.. 不要混乱了.

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注

Captcha Code

This site uses Akismet to reduce spam. Learn how your comment data is processed.