[ create a new paste ] login | about

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

PHP, pasted on Dec 7:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
	
class Foo {
	 protected function bar() {
		 echo __METHOD__ . "\n";
	}
}

class Baz extends Foo {
	
	function qux() {
		$this->bar(); // Baz extends Foo, so it inherits bar(), but it is not overriding it
                parent::bar();
	}
}

$baz = new Baz();
$baz->qux();


Output:
1
2
Foo::bar
Foo::bar


Create a new paste based on this one


Comments: