csdn的字体太难看,看代码头疼。

解决方案 »

  1.   

    up
    要点分
    上面是对 CParser类的定义和对CParser的SetSendFreq成员函数的实现
    其他的东西一点都没有这样怎么解释?
    感觉上是SetSendFreq是要对CParser确定序号,
    CParser可能是用来做数据包之类的东西
      

  2.   

    为什么要定义为:
    typedef  int  (FAR  PASCAL  *  LPFNSetSendFreq)(DWORD  dwActive,  DWORD  wAlarm1,  DWORD  dwAlarm2);
    在实现文件中:
    return  _lpfnSetSendFreq(dwActive,  dwAlarm1,  dwAlarm2);
    在那里实现?
    LPFNSetSendFreq  _lpfnSetSendFreq;//这个是干什么用的?
      

  3.   

    I don't know,
    so I want some numeric.
      

  4.   

    分数不成问题,我可以再开帖子送分,
    请解释:
    这个类直接就可以定义各种函数和他的实现函数,为什么要这样申明。
    而且,在实现函数中又返回类中定义的东西(LPFNSetSendFreq    _lpfnSetSendFreq)-----这是什么东西?
      

  5.   

    函数指针
    也可以说是回调函数至于回调函数的具体实现,你的代码中没哟给出来,你该看看 lpfnSetSendFreq
    是怎么初始化的,就应该知道了
      

  6.   

    UPUP 
    第一次做广告,实在是很急。 
    http://www.csdn.net/expert/topic/561/561652.xml?temp=.5516931
      

  7.   

    typedef  int  (FAR  PASCAL  *  LPFNSetSendFreq)(DWORD  dwActive,  DWORD  wAlarm1,  DWORD  dwAlarm2);//??  
    这是定义一个函数指针,任何 返回类型是int and the the type of  parametes are DWORD, DWORD,DWORD can be assigned the lpfnSetSendFreq.
      

  8.   

    typedef    int    (FAR    PASCAL    *    LPFNSetSendFreq)(DWORD    dwActive,    DWORD    wAlarm1,    DWORD    dwAlarm2); 
    是定义函数指针类型LPFNSetSendFreq。
    LPFNSetSendFreq    _lpfnSetSendFreq;
    声明一个函数指针类型的变量lpfnSetSendFreq。
    return    _lpfnSetSendFreq(dwActive,    dwAlarm1,    dwAlarm2); 
    调用_lpfnSetSendFreq指向的函数,返回函数运行结果。
    注意:
    函数指针是指向函数地址的指针。定义一个函数指针变量,从而可以在运行中确定该变量指向那个函数地址,从而确定调用那个函数
      

  9.   

    typedef  int  (FAR  PASCAL  *  LPFNSetSendFreq)(DWORD  dwActive,  DWORD  wAlarm1,  DWORD  dwAlarm2);//??  
        //LPFNSetSendFreq 定义了一个指向函数指针的类型,函数的参数如上
    public:  int  SetSendFreq(DWORD  dwActive,  DWORD  dwAlarm1,        DWORD  larm2);//??  CParser();  
        //定义了一个函数
    LPFNSetSendFreq  _lpfnSetSendFreq;//??  
        //_lpfnSetSendFreq是一个指向函数指针类型的变量return  _lpfnSetSendFreq(dwActive,  dwAlarm1,  dwAlarm2);//??  
        //调用函数
                (如果我没记错的话就是上面的,下面有一个例程序:console的)
    #include <iostream.h>
    typedef  int  ( *lpfnF)(int a,int b);//??  
    class  CParser  
    {  
    public:
    CParser(){_lpfn=0;};
    int  p(int a,int b);  
    static int  f(int a,int b)
    {
    cout << a<<endl;
    cout<<b<<endl;
    return 0;
    }; virtual  ~CParser(){};   lpfnF _lpfn;  
    };  int  CParser::p(int a,int b)
    {  
    if  (_lpfn != 0)  
    {  
    return _lpfn(a,b);  
    }  
    return -1;
    }  
     
    void main()
    {
    CParser cp;
    cp._lpfn = &CParser::f;
    cp.p(3,5);
    }输出为:
    3
    5
      

  10.   

    EvilSword(邪剑) 
    非常好!
    但我不明白为什么要这样定义?
    有什么好处?
      

  11.   

    我想这样定义不是为了有什么好处吧?有的时候不得不这样定义
    比如说显式调用DLL时候,你就要定义一个函数指针然后调用函数嘛,我想是这样的,不知道对不对了
      

  12.   

    please study c languge first and hard ...
    LPFNSetSendFreq  _lpfnSetSendFreq is definetion of the function pointer !