Learning PHP and MySQL

Example 05-14 Creating a new object without saving the reference

This is: Creating a new object without saving the reference, then creating an object to keep around.

<?php
new  Cat;
//the  Cat  object  cannot  be  accessed  since  its  reference  wasn’t  saved

$myCat=new  Cat;
//this  time  we've  kept  the  new  Cat  object  available
?>

Posted by on 08/03 at 08:22 AM

Next entry: Example 05-15 Adding the $age variable to Cat

Previous entry: Example 05-13 Defining three member functions for Cat

<< Back to main