<?php class A { protected int $v = 2; public function setValue(A $v, int $i): void { $v->v = $i; } public function getValue(A $v): void { echo $v->v; } } class B extends A { protected int $v { set => 1000; } } $a = new A; $b = new B; $a->setValue($b, 42); $a->getValue($b);
You have javascript disabled. You will not be able to edit any code.