Demo entry 2841806

qwas

   

Submitted by qwas on Oct 09, 2015 at 10:39
Language: PHP. Code size: 422 Bytes.

<?php
 class Animal {

    protected $name;

    public function __construct($name){
        $this->name = $name;
    }

    public function getName(){
        return $this->name;
    }
}

class Cat extends Animal {
    public function meow(){
        return "Cat {$this->getName()} is sayig meow";
    }
}

echo "test <br/>";
$cat = new Cat('Garfield');
echo $cat->getName();
echo $cat->meow();
?>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).