B
B
BonBon Slick2020-11-16 09:18:51
PHP
BonBon Slick, 2020-11-16 09:18:51

What is the meaning of abstract method access modifiers in abstract classes?

abstract class AbstractQueryFilter {

    abstract protected static function fromHttpRequest(Request $request): self;


final class AnimeSeasonFilter  extends AbstractQueryFilter {
    public ?int    $sequence;

    public static function fromHttpRequest(Request $request): self {
        return (new self($request))
            ->setSequence($request->get('sequence'))
            ;
    }


abstract classes cannot be initialized, only inherited.
Therefore, is there a private method or a protected one? After all access all the same defines child class.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
ddd329, 2020-11-26
@BonBonSlick

Such a class has two interfaces, one public for clients, and the second for heirs, i.e. tells them what to do.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question