Skip to content

Cat Class

Cat.php - OOP in PHP (Inheritance and Overriding): Complete Code Listing

1
2
3
4
5
6
7
8
9
<?php
    require_once('Pet.php');
    class Cat extends Pet
    {
        public function meow()
        {
            echo 'My cat ' . $this->name . ' is meowing.<br />';
        }
    }