I tried to override block file but I unable to see the output.
my script
di.xml file:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Theme\Block\Html\Topmenu" type="Company\Cms\Block\Html\Topmenu" />
</config>
Block file:
<?php
namespace Company\Cms\Block\Html;
class Topmenu extends \Magento\Theme\Block\Html\Topmenu{
protected function _getHtml(
\Magento\Framework\Data\Tree\Node $menuTree,
$childrenWrapClass,
$limit,
$colBrakes = []
) {
echo "exxit"; exit;
}
}
and I followed the below link for this