Example #1
0
            echo "<br>";
        }
    }
    public function howOld()
    {
        echo $this->name . " is " . $this->age . " years old.";
        echo "<br>";
        echo $this->name . " is " . $this->age . " cat years old!";
        echo "<br>";
    }
}
$cat1 = new Cat("Little Buddy", 2, 8);
$cat2 = new Cat("Sneaky Pete", 0, 2);
$cat3 = new Cat("whiskers", 1, 2);
$cat1->howOld();
$cat1->feedCat(6);
$cat3->howOld();
echo $cat2->name;
echo "<br>";
echo "TESTING!!!!";
$student1 = new Student('Harry', 'Potter', 17);
$student2 = new Student('Charlie', 'Brown', 16);
$student3 = new Student('Gary', 'Coleman', 15);
echo $student1->firstName;
echo "<br>";
echo $student1->lastName;
echo "<br>";
echo $student1->age;
echo "<br>";
//Rahjon's class
class Student
Example #2
0
    }
    public function howOld()
    {
        echo $this->name . " is " . $this->age . " years old.";
        echo "<br>";
        echo $this->name . " is " . $this->age . " cat years old!";
        echo "<br>";
    }
}
$cat1 = new Cat("Little Buddy", 2, 8);
$cat2 = new Cat("Sneaky Pete", 0, 2);
$cat3 = new Cat("Puppy cat", 3, 10);
$cat1->howOld();
$cat1->feedCat(6);
$cat3->howOld();
echo $cat3->age;
echo "<br>";
$cat2->howOld();
$cat2->feedCat(6);
echo $cat2->name;
echo "<br>";
?>

</body>
</html>