Original Post
Hiya, My current project uses an interface architecture, for example:
// IObject.h
class IObject
{
public:
IObject() {}
virtual bool Initialize() = 0;
}
// Object.h
class Object : public IObject
{
public:
Object();
bool Initialize();
} I use 'factory' like functions to create objects like this, for example bool CreateObject( IObject **ppObject ); internally creates an Object class instead of IObject. Sometimes I need arrays of objects though, and I'm not sure of the best way to do this. How should I create the array. I was thinking of something like: bool CreateObjectArray( IObject **ppObject, int iNumObjects )
{
*ppObject = new Object[iNumObjects];
} Is that OK, or is there a better way? Thanks for any replies, I hope that was clear enough :)