I want to override


with constructor argument.

Note : File overriding is working fine but when I create constructor in the overridden file it is giving me an error.

  • 1
    Please share your code
    – coderGeek
    Commented Aug 23, 2019 at 12:32

1 Answer 1


You need to pass parent constructor with your original class argument vendor/magento/module-catalog/Pricing/Price/FinalPrice.php


class A {
  public function __construct(Abc $abc){


class B extends A {
  public function __construct(Abc $abc,Xyz $xyz){
  • Please first check the file after reply, you can see there is a file and interface extended already.
    – MagentoDev
    Commented Aug 23, 2019 at 12:37
  • @MagentoDev you need to pass your parent class argument in the constructor.
    – Himanshu
    Commented Aug 23, 2019 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.