Using this in Hack Language is shown below:
As we see in the example below that 'this' can also be used as return type of a function and also to set the values of member variables of a class.
Example:
As we see in the example below that 'this' can also be used as return type of a function and also to set the values of member variables of a class.
Example:
<?hh class Base { private int $x = 0; public function setValue(int $x):this { $this->x = $x; // $this has type "this" return $this; }
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.