How to override a function in one controller to another controller?

Need to override confirmPage function in ClearcartController (currently in Checkoutcontroller.php) to add custom code. Could anyone help me in directing how to proceed in Shopware6… Thanks…