Skip to content

Instantly share code, notes, and snippets.

@recck
Created October 29, 2012 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save recck/3973596 to your computer and use it in GitHub Desktop.
Save recck/3973596 to your computer and use it in GitHub Desktop.
Programming in PHP - Week 7 - Day 13 - OOP
<?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