I am reading about design patterns in PHP and I keep seeing the following syntax, for example
abstract class AbstractObserver {
abstract function update(AbstractSubject $subject_in);
}
or
class PatternObserver extends AbstractObserver {
public function __construct() {
}
public function update(AbstractSubject $subject) {
}
}
(code is part of this example)
where "AbstractSubject" is another abstract class.
I am used to defining methods like methodName($var)
, not including a class name in there, like methodName(className $var)
.
So, what actually the class name does in a method ? My best guess is that it passes something like a reference in that class? Can you explain to me what it actually does?
Thanks