Archived

This topic is now archived and is closed to further replies.

supagu

using factories

Recommended Posts

well, i went ahead and made a few different types of factories, i have tried non-templates and inheriting from them, but this doesnt work as all inherited classes share the same static''s from the base factory class so i cant give each type of class a unique ID as if i change the static value, it will change for all classes. I have also tried using templates, but when trying to inherit from them is problematic eg. lets say my factory takes a base class and the current class, and it takes this base class and inherits from it. this doesnt work when the base class is the current class and it doesnt work well when you try to inherit from a class that is a subclass of the base class while trying to inherit from the factory template. I have seen some tutorials dont inherit from the template, but rather include thier template eg: static Factory< [this classes name ] > registerThis; im just wondering if this would actually work? i guess it could register the class, but i want to give each class a unquie ID eg: A::GetID() and B::GetID() plus those 2 classes should be registered with some class so i can go: Manager::Create( 1 ); OR Manager::Create( A::GetID() );

Share this post


Link to post
Share on other sites