+ 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.

12th Oct 2017, 6:02 PM
p-182-25
p-182-25 - avatar
1 Odpowiedź
+ 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.
12th Oct 2017, 8:01 PM
Oma Falk
Oma Falk - avatar