Created
May 13, 2011 19:12
-
-
Save AstonJ/971119 to your computer and use it in GitHub Desktop.
PHP
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
<? | |
class Ball | |
{ | |
private $_colour; | |
public function __construct($colour) | |
{ | |
$this->_colour = $colour; | |
} | |
public function is_red() | |
{ | |
return ($this->_colour == 'red' ? true : false); | |
} | |
} | |
$the_ball = new Ball('green'); | |
echo ($the_ball->is_red() ? '' : 'The ball is not red'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment