Pointer to a class (not an object)
Ok, in C++, is there a way to make a pointer to a class type (not an object of that class), similar to making a pointer to a function. I guess it really wouldn''t make sense, becuz functions have an address, whereas classes don''t, but I figured I''d ask anyways. Perhaps templates would be what I am looking for?
(Stolen from Programmer One)
UNIX is an operating system, OS/2 is half an operating system, Windows is a shell, and DOS is a boot partition virus
My only guess as to what you might be doing is dynamic object creation.
I create an object factory with:
typedef CAndromedaManageableObject*(*pt2Func)(void);
typedef map > OBJMAP;
Every Object in my object heirarchy must inmplement an interface:
public:
static CAndromedaManageableObject* InstantiateMe() { return new CAndromedaManageableObject; }
Then for every class I pass the InstantiateMe() function and the class name to the object factory for storage.
I create an object factory with:
typedef CAndromedaManageableObject*(*pt2Func)(void);
typedef map > OBJMAP;
Every Object in my object heirarchy must inmplement an interface:
public:
static CAndromedaManageableObject* InstantiateMe() { return new CAndromedaManageableObject; }
Then for every class I pass the InstantiateMe() function and the class name to the object factory for storage.
He''s a bad motha - Shut yo mouth.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement