Created
March 24, 2017 02:21
-
-
Save nouka/a60aeec8d5dc973a954086c9174660d2 to your computer and use it in GitHub Desktop.
Staticとは何か
This file contains 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 Human | |
{ | |
// Human型の太郎($taro)がする行動なので非static | |
public function say($what) | |
{ | |
echo $what; | |
} | |
// Human型のインスタンスはすべてHumanなのでstatic | |
public static function getType() | |
{ | |
echo __CLASS__; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment