[ create a new paste ] login | about

Link: http://codepad.org/DuBZfPhL    [ raw code | output | fork ]

PHP, pasted on Sep 8:
<?php
class base {
    function traverseTable($table) {
        foreach ($table as $element) {
            $rowCnt++;
            $this->uniqueSearch($rowCnt);
        }
    }
}

class child1 extends base {
    function search($input) {
        //parse input, get $table
        // dummy for now:
        $table = Array(0,1,2,3);
        $this->traverseTable($table);
    }

    function uniqueSearch($rowCnt) {
         echo 'child1';
        //Do different things
    }
}

class child2 extends base {
    function search($input) {
        //parse input, get $table
        // dummy for now:
        $table = Array(0,1,2,3);
        $this->traverseTable($table);
    }

    function uniqueSearch($rowCnt) {
         echo 'child2';
        //Do different things
    }
}

$c1 = new child1;
$c2 = new child2;

$c1->search("");
$c2->search("");
?>


Output:
1
child1child1child1child1child2child2child2child2


Create a new paste based on this one


Comments: