错误:'&'标记之前的预期初始值设定项 [英] error: expected initializer before '&' token

查看:267
本文介绍了错误:'&'标记之前的预期初始值设定项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以评论我在这里做错了什么吗?我是

重载输入和输出操作符并继续收到此错误。

这里是代码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?


这篇关于错误:'&amp;'标记之前的预期初始值设定项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆