Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class ParentClass {
protected $a = 1;
public function doSomething() {
echo "I'm the parent";
$this->a = 2;
}
}
class childClass {
public function doSomething() {
ParentClass::doSomething();
echo "I'm the child";
echo $this->a;
}
}
$c = new childClass();
$c->doSomething();
@Intrepidd

This comment has been minimized.

Copy link
Owner Author

@Intrepidd Intrepidd commented Jul 18, 2011

Surprising output!

Try to remove line 13.

@md2perpe

This comment has been minimized.

Copy link

@md2perpe md2perpe commented Jul 19, 2011

What's so surprising about the result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment