jeudi 20 décembre 2018

How to switch classes with same name and different namespaces?

I have red this article enter link description here

Main idea of the article is cast classes with same name to get more functionality. Its ok, i undestand it. But i cant undestand this code:

repository.query(new NewestNewsesSpecification());

He has NewestNewsesSpecification for sql and NewestNewsesSpecification for Realm.

So main question - how program can undestand what implementation NewestNewsesSpecification to use, if classes are with same names but in different namespaces? Its even not DI framework. Or it just every time i need different stotage i need find and change namespaces in code files?

Code of article in Java. Im writing in C#;

Aucun commentaire:

Enregistrer un commentaire