Home > Article > Backend Development > Static property issues in singleton pattern
In singleton mode, three private and one public are usually used. Why do we need to set a static attribute to store the object? Wouldn't it be enough to just set the attribute attribute to private? I beg you for your answer and detailed explanation.
In singleton mode, three private and one public are usually used. Why do we need to set a static attribute to store the object? Wouldn't it be enough to just set the attribute attribute to private? Please give me your answer and detailed explanation.
Because static member methods can only set and get static member properties,