mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-10-29 17:44:52 +08:00
* refactor: clean to roadmap content * refactor: move shared helpers into scripts/lib
826 B
826 B
The apply method
The apply function is a so-called smart constructor. It's the most popular way in Scala to create new instances of data types. It's more flexible than a standard constructor because it allows for running certain logic before deciding whether an instance should be created, and, if yes, it can create an instance of a certain subtype while returning it as an instance of a supertype.
Visit the following resources to learn more: