[ create a new paste ] login | about

Link: http://codepad.org/4KeXPUvi    [ raw code | output | fork ]

PHP, pasted on Jul 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

class Base {
  public function __toString() {
    return $this->name;
  }
}

class Concrete extends Base {
  private $name;

  public function __construct($name) {
    $this->name = $name;
  }
}

$o = new Concrete('foobar');
echo $o;


Output:
1
2

Fatal error: Cannot access private property Concrete::$name on line 5


Create a new paste based on this one


Comments: