Skip to content

Instantly share code, notes, and snippets.

@Intrepidd
Created July 18, 2011 22:24
Show Gist options
  • Select an option

  • Save Intrepidd/1090844 to your computer and use it in GitHub Desktop.

Select an option

Save Intrepidd/1090844 to your computer and use it in GitHub Desktop.
<?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();
@md2perpe

Copy link
Copy Markdown

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