错误:'&'标记之前的预期初始值设定项 [英] error: expected initializer before '&' token
问题描述
有人可以评论我在这里做错了什么吗?我是
重载输入和输出操作符并继续收到此错误。
这里是代码snipets,谢谢
朋友ostream &安培; operator<<(ostream& outs,const big_int&
source){
outs<< source.get_b1()<< " " << source.get_b2();
退货;
}
朋友istream&运算符>>(istream& ins,const big_int&
target){
ins>> target.big_int1>> target.big_int2;
返回ins;
}
can someone please comment on what i may be doing wrong here? i am
overloading input and output operators and keep getting this error.
here are the code snipets, thanks
friend ostream & operator <<(ostream & outs, const big_int &
source){
outs << source.get_b1() << " " << source.get_b2();
return outs;
}
friend istream & operator >>(istream & ins, const big_int &
target){
ins >> target.big_int1 >> target.big_int2;
return ins;
}
推荐答案
是在定义
函数之前,您是否对big_int类型进行了原型设计?这可能会导致问题。
Are you prototyping your big_int type before you are defining your
functions? That might cause the problem.
big_int是类类型。另外,我的其他重载操作符都没有这个错误
big_int is the class type. also, my other overloaded operators are not
stricken with this error
我知道big_int是你的类类型,但是它是在宣布你的职能之前定义或至少是b $ b原型?这些其他功能你是什么意思?你有一个例子吗?
I know big_int is your class type, but is it defined or at least
prototyped before you declare your functions? These other functions you
speak of -- do you have an example?
这篇关于错误:'&'标记之前的预期初始值设定项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!