Created
August 1, 2020 10:00
-
-
Save PJZ9n/5ee290346933911aabb7badf4f81df2d to your computer and use it in GitHub Desktop.
メンバ変数のアクセス修飾子
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 | |
declare(strict_types=1); | |
class aClass | |
{ | |
private $hoge = "fuga"; | |
} | |
class bClass | |
{ | |
public function __construct(aClass $a) | |
{ | |
var_dump($a->hoge);//アクセス出来ません | |
} | |
} |
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 | |
declare(strict_types=1); | |
class aClass | |
{ | |
public $hoge = "fuga"; | |
} | |
class bClass | |
{ | |
public function __construct(aClass $a) | |
{ | |
var_dump($a->hoge);//アクセス出来ます | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment