Call a method from a parent class with the scope resolution operator

Views: 16 Last modified: August 03rd, 2011 Comments: 0

You can call a method from a parent class like this:

<?php
class something{
    public $a = 'test';
    public function showthis(){
        echo 'Put your code here';
    }
}

class dosomethingelse extends something{
    public function show(){
        parent::showthis();
    }
}

$do = new dosomethingelse;

$do->showthis();
?>

Output

Put your code here
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

    Mail this!

    To: From:Sum {5+6} =  
    Anything to add ?

        You must be logged in to post a comment.