Jump to content

C++ Singleton Class Question/Problem


Go to solution Solved by ricky92,

Recommended Posts

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 by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
Link to comment
https://metin2.dev/topic/1042-c-singleton-class-questionproblem/
Share on other sites

  • Solution

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.

  • Love 1
  • 9 years later...

Singleton = Instance

Okey.

Example:

MyClass::Instance().Reset()

 

MyClass = Class Name

Instance = Grant Access (Name)

Reset() = Function Name

Edited by BadRomani

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.