Simple factory method

Go back

Here is link to onlinegdb with the code for a simple factory method.

And here is the code