Re: static method using a default instance?

2024-04-19 Thread Tommy
If I understand this correctly, I would make separate static factory methods to create instances. It is easier / cleaner IMHO if you define your final objects as interfaces then you can supply different implementations depending on some state. In my current project I'm making API interfaces for

static method using a default instance?

2024-04-19 Thread o...@ocs.cz
Hi there, I've bumped into a pretty trivial problem, but probably I've got a dumb day today — can't find a solution :( How does one write a method which can be called either over an instance, or over a class, in which case it would automatically use a default instance? Like this, in pseudo-cod