Pergunta de entrevista da empresa eBay

What is factory pattern? Explain with example? What are advantages and disadvantages of this pattern?