All pastes #579851 Raw Edit

jmccaffrey

public php v1 · immutable
·published 2007-06-20 21:14 UTC
rendered paste body
<?php	class CPerson	{		public function sayHi()		{			echo "Person says Hi\r\n";		}	}		class CStudent	{		public function doHomework()		{			echo "Student does homework\r\n";		}	}		interface IPerson	{		public function sayHi();	}		interface IStudent	{		public function doHomework();	}		class CParent implements IPerson, IStudent	{		private $person;		private $student;				public function CParent()		{			$this->person = new CPerson();			$this->student = new CStudent();		}				public function sayHi()		{			$this->person->sayHi();			echo "\tParent adds additional greetings\r\n";		}				public function doHomework()		{			$this->student->doHomework();			echo "\tParent does homework\r\n";		}	}		$p = new CParent();	$p->sayHi();	$p->doHomework();?>