标题:小白求助 模板类中友元函数重载<<运算符 应该怎么写?
取消只看楼主
d7se123
Rank: 2
等 级:论坛游民
帖 子:65
专家分:14
注 册:2020-3-13
结帖率:50%
 问题点数:0 回复次数:0 
小白求助 模板类中友元函数重载<<运算符 应该怎么写?
class Complex
{
public:
    friend ostream& operator<<(ostream& out,Complex& c);
}

//类外
ostream& operator<<(ostream& out,Complex<T>& c)
{
    out<<c.a<<" "<<c.b<<endl;
    return out;
}
这样写报错 模板类中友元函数重载<<运算符 应该怎么写?
搜索更多相关主题的帖子: out 类中 运算符 友元 函数重载 
2020-05-14 11:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-501604-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.251047 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved