Last active
December 14, 2017 17:23
-
-
Save polidog/0e6c0bf63105fc279b16f06293427bad to your computer and use it in GitHub Desktop.
privateなプロパティにアクセスできるのか!!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Category | |
{ | |
private $id; | |
public function __construct($id) | |
{ | |
$this->id = $id; | |
} | |
public function equals(Category $category): bool | |
{ | |
return $this->id === $category->id; | |
} | |
} | |
$c1 = new Category(1); | |
$c2 = new Category(1); | |
var_dump($c1->equals($c2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment