Guest User

Untitled

a guest
Dec 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. <?php
  2.  
  3. class Category
  4. {
  5. private $id;
  6.  
  7. public function __construct($id)
  8. {
  9. $this->id = $id;
  10. }
  11.  
  12. public function equals(Category $category): bool
  13. {
  14. return $this->id === $category->id;
  15. }
  16. }
  17.  
  18. $c1 = new Category(1);
  19. $c2 = new Category(1);
  20.  
  21. var_dump($c1->equals($c2));
Add Comment
Please, Sign In to add comment