Consider below code :
<?php
trait HelloWorld {
public function sayHello() {
echo 'Hello World!';
}
}
// Change visibility of sayHello
class MyClass1 {
use HelloWorld { sayHello as protected; }
}
// Alias method with changed visibility
// sayHello visibility not changed
class MyClass2 {
use HelloWorld { sayHello as private myPrivateHello; }
}
?>
How should I access the method sayHello()
after changing its visibility either withing the current class as the new visibility has been set to protected in one class and set to private in another class with an alias?
How to access the public method sayHello()
with the object of some class defined in the trait?
The term "Exhibiting Class" has been used in the PHP manual. Someone please explain what this term "Exhibiting Class" means which class?