Dependency Inversion Principle
”The Dependency Inversion Principle (DIP) tells us that the most flexible systems are those in which source code dependencies refer only to abstractions, not to concretions.” (Robert C. Martin, Clean Architecture)
”a. High-level modules should not depend on low-level modules. Both should depend on abstractions. b. Abstractions should not depend on details. Details should depend on abstractions.” (Robert C. Martin, Agile Software Development)
CONCLUSION
Prefer to depend on abstractions (i.e. abstract classes or concepts) instead of concrete types.