<?php
$a = new my_class;
$b = clone $a;
?><?php
class my_class {
function __construct() {
echo "Constructor";
}
function __destruct() {
echo "Destructor";
}
}
?><?php
class my_class {
public $a;
protected $b;
private $c;
}
?><?php
class my_class {
function __set($name, $value) { }
function __get($name) { }
function __call($name, $args) { }
}
?><?php
class the_class {
public $var = 'foo';
}
class my_other_class {
public function __construct(the_class $obj) {
echo $obj->var;
}
}
$a = new the_class;
$b = new my_other_class($a);
$c = new my_other_class($b);
?><?php
interface abc {
public function setVariable($name, $var);
public function getVariable($name);
}
class my_abc implements abc {
private $vars = array();
public function setVariable($name, $var) {
$this->vars[$name] = $var;
}
public function getVariable($name) {
return $this->vars[$name];
}
}
$test = new my_abc;
$test->setVariable('foo','bar');
echo $test->getVariable('foo');
?><?php
class my_other_class implements abc {
public function setVariable($name, $var) {
$this->vars[$name] = $var;
}
}
?><?php
class my_main_class {
public function foo() { }
final public function bar() { }
}
class my_other_class extends my_main_class {
public function foo() { }
public function bar() { }
}
?><?php
abstract class Base {
public function __toString() {
return '<pre>'.print_r($this,TRUE).'</pre>';
}
}
?><?php
function __autoload($class) {
echo "autoload called for $class\n";
require "presentations/slides/keynotes/$class.inc";
}
class my_class2 extends Base {
function __construct($arg) {
$this->prop = $arg;
}
}
$test = new my_class2('foo');
echo $test;
?>