🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Pointer to a class (not an object)

Started by
1 comment, last by Dragon88 20 years, 11 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
Advertisement
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.
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