I have a custom overriden class say Result.php overridden from CatalogSearch module.
Now if i have to use this Result class in 2 different modules(Module1 and Module2), do i have to override the class in both the modules (in the 'type' attribute of di)??
etc/di of Module1:
<preference for="Magento\CatalogSearch\Block\Result" type="Vendor/Module1/Block/Result">
etc/di of Module2:
<preference for="Magento\CatalogSearch\Block\Result" type="Vendor/Module2/Block/Result">
In the above case, if i want to track as to which Result from my custom module is getting called?
PROBLEM:
I tried echo in Module1's Result class somefun(), i get it, but i comment out the same and try in Module2's Result class somefun(), i dont get
Why?
Can i use something like this in Module2 di.
<preference for="Magento\CatalogSearch\Block\Result" type="Vendor/Module1/Block/Result">
I gave module1 in type