Quiz · Inheritance and interfaces · lesson 6 of 8
Quiz — class method vs trait method
Question 1 of 2
What does the program print?
<?php
trait Greets
{
public function hello(): string { return 'trait'; }
}
class App
{
use Greets;
public function hello(): string { return 'class'; }
}
echo (new App())->hello(), "\n";