hi,
i'd like to use a singleton for one of my classes. The class has an attribute named oid and i will need one instance for every value of oid - i just need to make sure there is no second one.
so i tried:

Qt Code:
  1. class cAnlagenArt {
  2. public:
  3. static cAnlagenArt* self( QString oid );
  4. private:
  5. static QMap<QString, cAnlagenArt* > _self;
  6. }
To copy to clipboard, switch view to plain text mode 

and tried the following:
Qt Code:
  1. cAnlagenArt* cAnlagenArt::self(QString oid) {
  2. if ( ! _self.contains(oid) )
  3. _self[oid] = new cAnlagenArt( oid );
  4. return _self[oid];
  5. }
To copy to clipboard, switch view to plain text mode 
which gets me lots of
undefined reference to `cAnlagenArt::_self'

how else can i do this?