Created
June 17, 2014 13:47
-
-
Save shouhei/3caa199c01b652356753 to your computer and use it in GitHub Desktop.
Object Oriented PHP
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 Rippotai { | |
| private $tate; | |
| private $yoko; | |
| private $takasa; | |
| public function __construct($tate,$yoko,$takasa){ | |
| $this->tate = $tate; | |
| $this->yoko = $yoko; | |
| $this->takasa = $takasa; | |
| } | |
| public function teimennseki(){ | |
| return $this->tate * $this->yoko; | |
| } | |
| public function taiseki(){ | |
| return $this->tate * $this->yoko * $this->takasa; | |
| } | |
| } |
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 | |
| require "sample.php"; | |
| $ripo = new Rippotai(5,5,5); | |
| echo $ripo->teimennseki(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment