Static set member.

Smith-Rowland, Edward M ESmith-rowland@alionscience.com
Tue Aug 29 21:37:00 GMT 2006


All,

I am attempting to create a singleton class something like this:

class ThingManager
{

    static void show( Thing * thng );
    static void hide( Thing * thng );
    static void hideAll( void );

private:

    static std::set<Thing *,ThingComp> thingSet;
};

I get these errors:
[ed@localhost ~]$ g++ thing.cpp
thing.cpp: In static member function `static void ThingManager::show(Thing*)':
thing.cpp:7: error: `thingList' was not declared in this scope
thing.cpp: In static member function `static void ThingManager::hide(Thing*)':
thing.cpp:13: error: `thingList' was not declared in this scope
thing.cpp: In static member function `static void ThingManager::hideAll()':
thing.cpp:19: error: `thingList' was not declared in this scope

More details (still simple) in the attached files.

What am I doing wrong???

Adding a constructor or initializer to the cpp file is an error:
std::set<Thing *,ThingComp> ThingManager::thingSet();

Ed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: thing.cpp
Type: text/x-c++src
Size: 272 bytes
Desc: thing.cpp
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20060829/ec6d00e4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thing.h
Type: text/x-chdr
Size: 487 bytes
Desc: thing.h
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20060829/ec6d00e4/attachment-0001.bin>


More information about the Gcc-help mailing list