How to implement static class member functions in *.cpp file?

前端 未结 8 1467
Happy的楠姐
Happy的楠姐 2020-12-07 15:35

Is it possible to implement static class member functions in *.cpp file instead of doing it in the header file ?

Are all static functions a

8条回答
  •  北海茫月
    2020-12-07 15:56

    Try this:

    header.hxx:

    class CFoo
    {
    public: 
        static bool IsThisThingOn();
    };
    

    class.cxx:

    #include "header.hxx"
    bool CFoo::IsThisThingOn() // note: no static keyword here
    {
        return true;
    }
    

提交回复
热议问题