How to override template with block class in Magento 2.2.1
Use this :
<referenceBlock name="page.main.title">
<action method="setTemplate">
<argument name="template" xsi:type="string">Vendor_Module::html/title.phtml</argument>
</action>
</referenceBlock>
To override class using di.xml
:
<preference for="Magento\Catalog\Block\Product\View" type="Vendor\ModuleName\Block\Product\View" />
Hope it Helps!