Question from the PHP8 test

How to use a final private method in PHP

Medium

What will it be displayed?

<?php

class Foo
{
    public function getFullName()
    {
        return $this->getName() .  ' surname';
    }
    
    final private function getName()
    {
        return 'name';
    }
}

$foo = new Foo();
echo $foo->getFullName();
Author: MathisStatus: Published(Update)Question passed 41 times
Edit
0
Community Evaluations
developer avatar
Vincent Cotro
14/11/2023
Merci pour la correction Mathis !