专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > C语言

急问! 关于std:list的有关问题 必加分!

发布时间:2011-06-28 15:41:29 文章来源:www.iduyao.cn 采编人员:星星草
急问!! 关于std::list的问题 必加分!!!
急问!!   关于std::list的问题   必加分!!!

现在定义了函数指针
void   (*   printDoc)   (std::list <std::string>   &   oMyPrintList);

怎么使用这个函数指针呢?
初始化了一个指针pPrintInfo

pPrintInfo-> printDoc(std::list <std::string>   &   oOutPutList);

老是编译有错误:
error   C2275:   '_STL::list <class   _STL::basic_string <char,class   _STL::char_traits <char> ,class   _STL::allocator <char>   > ,class   _STL::allocator <class   _STL:
:basic_string <char,class   _STL::char_traits <char> ,class   _STL::allocator <char>   >   >   > '   :   illegal   use   of   this   type   as   an   expression


pPrintInfo-> printDoc(std::list   &   oOutPutList);
这样也不行
error   C2275:   '_STL::list '   :   illegal   use   of   this   type   as   an   expression

怎么回事?   谢谢!!!!!

------解决方案--------------------
pPrintInfo-> printDoc(oOutPutList);

------解决方案--------------------
呃,楼主啊,你C语言书函数调用章节都没看过吗?
要调一个函数,就要给它参数。通过函数指针来调函数,也是调函数,也要给它参数。
你当然是先要定义一个std::list <std::string> oOutPutList;这样的变量来作参数呀。
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: