How do I get a PHP class constructor to call its parent’s parent’s constructor?

I need to have a class constructor in PHP call its parent’s parent’s (grandparent?) constructor without calling the parent constructor.

// main class that everything inherits
class Grandpa 
{
    public function __construct()
    {

    }

}

class Papa extends Grandpa
{
    public function __construct()
    {
        // call Grandpa's constructor
        parent::__construct();
    }
}

class Kiddo extends Papa
{
    public function __construct()
    {
        // THIS IS WHERE I NEED TO CALL GRANDPA'S
        // CONSTRUCTOR AND NOT PAPA'S
    }
}

I know this is a bizarre thing to do and I’m attempting to find a means that doesn’t smell bad but nonetheless, I’m curious if it’s possible.

15 Answers
15

Leave a Comment