Skip to content

Getting error after overwrite core file of sitemap module. magento2

I have successfully overwrite core file: MagentoSitemapModelResourceModelCatalogProduct

but getting error in public function getCollection($storeId) for this: $this->scopeConfig->isSetFlag and $this->getConnection() method not found.

When try to overwrite whole file getting this error:
Incompatible argument type: Required type: MagentoSitemapHelperData. Actual type: string;

Ref: I have overwrite core file as this:
magento 2.3 how to override protected function in custom module

Any help will be appreciated.
Thanks.