Pergunta de entrevista da empresa ServiceNow

what is factory pattern? stack implementation code