Implementation examples

Report a typo

Take a look at these pseudocode snippets for few methods:

1)

method clone():Object is
  return new Object()

2)

method ObjectCreate(String name) is
  if (Object == John) then
    object = new John
  else if (Shape == Jill) then
    object = new Jill
  else
    Print "Error"

3)

method getInstance() is
  if (instance == null) then
     instance = new Object()
  return instance

Which of these methods is a part of singleton implementation?

Select one option from the list
___

Create a free account to access the full topic