public function demonstrateBirdness() { $this->fly(); $this->sing(); } } /* * instantiate the class * */ echo "<p>Create a new Bird Object...</p>"; $hummingbird = new Bird(); /* try out the various functions */ echo "<p>Run sing() function...</p>"; $hummingbird->sing(); echo "<p>Run and echo getSong() function ...</p>"; echo $hummingbird->getSong(); echo "<p>Run setSong() to change the Brid's song...</p>"; $hummingbird->setSong("Caw caw!"); echo "<p>Run and echo the song to prove it has been changed...</p>"; echo $hummingbird->getSong(); echo "<p>Run demonstrateBirdness()...</p>"; $hummingbird->demonstrateBirdness(); echo "<p>Create another new Bird Object...</p>"; $eagle = new Bird(); $eagle->setSong("Screech!"); $eagle->demonstrateBirdness(); ?> </span> <h3>Comparing Objects</h3>
<? include ('bird.php'); $blue_jay=new Bird(); $blue_jay->sing(); //echos "Tweet!! Tweet!!" ?>