2024-07-11
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Creational pattern (4 types): used to describe "how to create an object", its main feature is "separating the creation and use of objects".
The common factory method pattern is to establish a factory class to create instances of some classes that implement the same interface. First, look at the relationship diagram:
Take an example of sending emails and text messages. First, create a common interface for both:
public interface Sender {
public void Send();
}