php - Hacklang tutorial - this type in extend class -


what correct answer hack tutorial exercice 16?
link tutorial: hacklang tutorial

my modified code (not marked solution):

<?hh // type 'this' points derived type class mybaseclass {   protected int $count = 0;    public function add1(): {     $this->count += 1;     return $this;   } }  class myderivedclass extends mybaseclass {   public function print_count(): void { echo $this->count; } }  function test(): void {   $x = new myderivedclass();   $x->add1()->print_count(); } 

i replaced mybaseclass this still not marked correct (green text exercice number) .. correct answer?

i'm engineer working on hack. i'm pretty sure have bug in our completion detection logic exercise in tutorial. code looks correct me -- changing return type this is, far can see, supposed do. i'll follow , bug fixed. sorry that!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -