Advertisement

Pointer to a class (not an object)

Started by July 16, 2003 12:41 PM
1 comment, last by Dragon88 21 years, 4 months ago
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.
He''s a bad motha - Shut yo mouth.
Advertisement
That looks about like what I''m trying to do, I''ll give it a try. Thanx.


(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

This topic is closed to new replies.

Advertisement