Hi, been a while since my last post. Been busy with a project.

Okay here's the question. I have an object that should only have an instance. But the object should not be created with the default constructor. It's because to create the object, the programmer should define the parameters of the creation of the object. I was thinking of doing this:

Code:
clase CObject
{
    public:
        CObject * getInstance(param A, param B, param C, ...); //To get the instance of the object and create it if it wasn't already created
        methodA();
    private:
        static CObject * mTheObject;
        CObject(param A, param B, param C,...);
}

CObject * CObject::getInstance(param A, param B, param C, ...)
{
  if (mTheObject==0)
          mTheObject=new CObject(param A, param B, param C, ...);
  return mTheObject;
}
With this code, e.g., if I wanted to call method a, should call it with:
Code:
CObject::getInstance(param A, param B, param C, ...)->methodA();
But getting the instance with parameters that just only needed once to create the object is not too efficient so I was hesitant to implement it. I could just make it a generic one and just make sure I didn't make it more than once throughout my code. But I just wanted to see a different approach in this. Any idea?

Thanks in advance.