Зачем нужна функция sayit?
В курсе PHP на первом занятии по ООП не совсем понятно зачем нужна функция sayIt() если тоже самое делает функция getWords().
class human {
private $words;
public function setwords($words)
{
$this->words=$words;
}
public function getwords(){
return $this->words;
}
public function sayit(){
return $this->getwords();
}
}
$human = new human();
$human->setwords("Слово");
echo $human->sayIt();
// В echo же можно написать просто $human->getwords();