Skip to content

Dog Class

Dog.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 Dog extends Pet
    {
        public function bark()
        {
            echo $this->name . ' is barking.<br />';
        }
    }