首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

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

2012-02-04 
急问!! 关于std::list的问题 必加分!!!急问!!关于std::list的问题必加分!!!现在定义了函数指针void(*print

急问!! 关于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;这样的变量来作参数呀。

热点排行