Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

herencia php

<?php
class MyClass
{
    protected function myFunc() {
        echo "MyClass::myFunc()
";
    }
}

class OtherClass extends MyClass
{
    // Override parent's definition
    public function myFunc()
    {
        // But still call the parent function
        parent::myFunc();
        echo "OtherClass::myFunc()
";
    }
}

$class = new OtherClass();
$class->myFunc();
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #herencia #php
ADD COMMENT
Topic
Name
1+5 =