Pattern in pseudocode

Report a typo

This pseudocode depicts a design pattern. Is it the factory method or prototype?

global instance

class Object is
  constructor Object() is ...

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

  method doThing() is
    print Object

class Application is
  method main() is
    Object foo = Object.getInstance()
    foo.doThing()
    //"foo" will be printed
    Object bar = Object.getInstance()
    bar.doThing()
    //"foo" will be printed again
Select one option from the list
___

Create a free account to access the full topic