Use class without instance (like e.g. String)

Can you give an example of use of String that doesn't build an instance? (Trick question!)

Why do you want to develop a class for this? Why not just develop a function?

What is dateConvert() in your example? What type does it return?

You could develop a class which takes whatever type dateConvert() returns as a constructor parameter and has a toMyFormat() method. But why do that? It's less efficient than a normal function.

1 Like