_beforeTokenTransfer overrride error

i have problem in override _beforeTokenTransfer
Function has override specified but does not override anything.(7792)
Member "_beforeTokenTransfer" not found or not visible after argument-dependent lookup in type(contract super DotToken).(9582)

// contracts/DotToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";

contract DotToken is ERC20Capped, ERC20Burnable  {
    address payable public owner;
    uint256 public blockReward;

    constructor(uint256 cap, uint256 reward) ERC20("DotToken","DTT") ERC20Capped(cap * (10**decimals())){
        owner= payable(msg.sender);
        _mint(owner, 70000000000 * (10** decimals()));
        blockReward=reward* (10** decimals());
    function _update(address from, address to, uint256 value) internal virtual override(ERC20Capped,ERC20) {
        super._update(from, to, value);

        if (from == address(0)) {
            uint256 maxSupply = cap();
            uint256 supply = totalSupply();
            if (supply > maxSupply) {
                revert ERC20ExceededCap(supply, maxSupply);

    function _mintMinerReward()internal{
        _mint(block.coinbase, blockReward);

     function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
        if(from != address(0) && to != block.coinbase && block.coinbase != address(0) && ERC20.totalSupply() + blockReward <= cap()) {
        super._beforeTokenTransfer(from, to, amount);

    function setBlockReward(uint256 reward) public onlyOwner{
    function destroy() public onlyOwner{

    modifier onlyOwner{
        require(msg.sender==owner,"Only the owner can call this function");

You are trying to override _beforeTokenTransfer , but it is no more a function in OZ ERC20 implementation. That's replaced by the _update function.

Remove that and include whatever the logic is, inside the _update function.