I am reading "Design Patterns" by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. In chapter of factory method, there's one paragraph:
"Factory method in C++ are always virtual functions and are often pure virtual. Just be careful not to call factory methods in the Creator's constructor - the factory method in the ConcreteCreator won't be available yet."
I don't understand why the factory method in ConcreteCreator won't be available yet? is it because C++ is a compiled language therefore the method of the children class won't be available as the parent class is compiled first? Thank you.
Aucun commentaire:
Enregistrer un commentaire