I want create interface for singleton. But interface not can ban public constructor and describ static method. how to solve this of problems?
You cannot have a ISingleton interface for two reasons:
You could have a ASingleton abstract class if you liked.
You can't, basically. Interfaces can't contain static methods, and can't put any constraints on what kind of constructors are available.
You might be interested in my notion of static interfaces, which would allow the idea of enforcing a particular static member to be present - but it wouldn't allow you to enforce the absence of a constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With