Title: Factory Method
Description: Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
Domain: refactoring.guru
{"@context":"http://schema.org","@graph":[{"@type":"Person","@id":"https://refactoring.guru/#founder","name":"Alexander Shvets"},{"@type":"Organization","@id":"https://refactoring.guru/#organization","name":"Refactoring.Guru","description":"Refactoring.Guru makes it easy for you to discover everything you need to know about refactoring, design patterns, SOLID principles, and other smart programming topics.","image":{"@type":"ImageObject","@id":"https://refactoring.guru/#organizationlogo","url":"https://refactoring.guru/images/content-public/logos/logo-plain.png","caption":"Refactoring.Guru"},"logo":{"@id":"https://refactoring.guru/#organizationlogo"},"founder":{"@id":"https://refactoring.guru/#founder"},"sameAs":["https://www.facebook.com/refactoring.guru","https://twitter.com/RefactoringGuru","https://github.com/RefactoringGuru"]},{"@type":"WebSite","@id":"https://refactoring.guru/#website","url":"https://refactoring.guru/","name":"Refactoring.Guru","description":"Refactoring.Guru makes it easy for you to discover everything you need to know about refactoring, design patterns, SOLID principles, and other smart programming topics.","author":{"@id":"https://refactoring.guru/#founder"},"publisher":{"@id":"https://refactoring.guru/#organization"},"copyrightYear":2014},{"@type":"WebPage","@id":"https://refactoring.guru/design-patterns/factory-method#webpage","url":"https://refactoring.guru/design-patterns/factory-method","inLanguage":"en","name":"Factory Method","description":"Factory Method is a creational design pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.","isPartOf":{"@id":"https://refactoring.guru#website"},"breadcrumb":{"@id":"https://refactoring.guru/design-patterns/factory-method#breadcrumb"},"primaryImageOfPage":{"@id":"https://refactoring.guru/design-patterns/factory-method#primaryimage"},"image":{"@type":"ImageObject","@id":"https://refactoring.guru/design-patterns/factory-method#primaryimage","url":"https://refactoring.guru/images/patterns/content/factory-method/factory-method-en-3x.png","width":1920,"height":1200}},{"@type":"Article","@id":"https://refactoring.guru/design-patterns/factory-method#article","isPartOf":{"@id":"https://refactoring.guru/design-patterns/factory-method#webpage"},"mainEntityOfPage":{"@id":"https://refactoring.guru/design-patterns/factory-method#webpage"},"author":{"@id":"https://refactoring.guru#founder"},"publisher":{"@id":"https://refactoring.guru#organization"},"headline":"Factory Method","datePublished":"2025-01-01","dateModified":"2026-01-01","articleSection":"Design Patterns","image":{"@id":"https://refactoring.guru/design-patterns/factory-method#primaryimage"}},{"@type":"BreadcrumbList","@id":"https://refactoring.guru/design-patterns/factory-method#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://refactoring.guru"},{"@type":"ListItem","position":2,"name":"Design Patterns","item":"https://refactoring.guru/design-patterns"},{"@type":"ListItem","position":3,"name":"Creational Patterns","item":"https://refactoring.guru/design-patterns/creational-patterns"}]}]}
| theme-color | #19222E |
| fb:app_id | 666819623386327 |
| og:type | website |
| og:image | https://refactoring.guru/images/refactoring/social/facebook-share-preview.png?id=dbf9e98269595be86eb668f365be6868 |
Links:
Viewport: width=device-width, initial-scale=1, shrink-to-fit=no