The instance function

To finish plugging in the concrete factory, you must create the instance function, defined in <env>OS.cpp, which returns a pointer to the concrete operating system factory. The instance method creates a single instance of the OMOSFactory. It is defined as follows:

static OMOSFactory* instance();

For example, in VxWorks, the declaration is as follows:

OMOSFactory* OMOSFactory::instance()
{
   static VxOSFactory theFactory;
   return &theFactory;
}

Feedback