+ 2
I need an example.
I realize functions can return different data types including objects. Can anyone show an example or a source to such, of how functions return objects, best with purpose of this and some explanation + when and why such constructions are useful. C# and java examples most welcome for now. Thanks.
1 Antwort
+ 4
https://en.m.wikipedia.org/wiki/Singleton_pattern
Singleton is a pattern which ensures to have max 1 instance of a class.
it returns that instance if one tries to create a new imstance.