ShuzZzle 28 Posted May 1, 2014 Share Posted May 1, 2014 (edited) Iam currently stuck with a Singleton Class problem (err:https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif). In my header file i bequeathed the singleton class to my CMyClass Class class CMyClass: public singleton<CMyClass> Do I have to something else apart from bequeathing? Because Everytime i try to execute the function I get the error above. Without the Singleton Function it is working. So there is no logic mistake. Can Somebody explain me what i have to do in order to use the ymir Singleton template Class? Kind Regards Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Honorable Member NoFr1ends 751 Posted May 1, 2014 Honorable Member Share Posted May 1, 2014 I think you should use CSingleton instead of singleton. Than you can simply get the instance with CMyClass::instance() Kind regards Chuck Link to comment Share on other sites More sharing options...
Solution ricky92 29 Posted May 1, 2014 Solution Share Posted May 1, 2014 The singleton class in Ymir's sources does not make use of lazy initialization, so you actually need to explicitly initialize it somewhere. Open up the main.cpp file and you'll see many (if not all) of the singleton classes initialized on the stack there: do the same for your class and it should work fine. Link to comment Share on other sites More sharing options...
ShuzZzle 28 Posted May 1, 2014 Author Share Posted May 1, 2014 Thanks a lot ricky92. Totally forgot that Link to comment Share on other sites More sharing options...
BadRomani 14 Posted December 30, 2023 Share Posted December 30, 2023 (edited) Singleton = Instance Okey. Example: MyClass::Instance().Reset() MyClass = Class Name Instance = Grant Access (Name) Reset() = Function Name Edited December 30, 2023 by BadRomani Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now