Created
October 29, 2012 13:38
-
-
Save recck/3973596 to your computer and use it in GitHub Desktop.
Programming in PHP - Week 7 - Day 13 - OOP
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 FirstClass { | |
public $public; | |
protected $protected; | |
private $private; | |
public function __construct($public, $protected, $private){ | |
$this->public = $public; | |
$this->protected = $protected; | |
$this->private = $private; | |
} | |
public function getPrivate(){ | |
return $this->private; | |
} | |
public function changePrivate($newValue){ | |
$this->private = $newValue; | |
} | |
} | |
$class = new FirstClass('public', 'protected', 'private'); | |
echo $class->public . '<br />'; | |
$class->public = 'new public'; | |
echo $class->public; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment