Jump to content
  • Advertisement


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


using factories

This topic is 5480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!