0

I have experience in programming with php and i think i have a good understanding of what a constructor does. But in Magento the constructor is called with the implemented Dependency's but after that the parent::__construct is also called and that has some parameters, but i can't seem to understand why these parameters are there and why you would need the parrent constructor or is it the constructor called in the same file i don't know so me be some one can explain it to this nood haha

this is an example

public function __construct(
    \Magento\Framework\App\Action\Context $context,
) {
    parent::__construct(
        $context
    );
}
1

1 Answer 1

0

When we extends the class and that class have

__construct

and that assign some default value to the methods and variable.

So for the same things we are using this code here.

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.