I have a feeling that what I am trying to do is impossible as I can't find anything on it. I have a few classes that extend from another class. Inside of the class that is being extended, I have to call some unique code based on which class is calling it.
This is something of an in-depth project, so I created a testcase that should explain what I am trying to do:
class parent {
function traverseTable($table) {
foreach($table->getElementsByTagName('tr') {
$rowCnt++;
$this->uniqueSearch($rowCnt);
}
}
}
class child1 extends parent {
function search($input) {
//parse input, get $table
$this->traverseTable($table);
}
function uniqueSearch($rowCnt) {
echo 'child1';
//Do different things
}
}
class child2 extends parent {
function search($input) {
//parse input, get $table
$this->traverseTable($table);
}
function uniqueSearch($rowCnt) {
echo 'child2';
//Do different things
}
}
Basically, I want to be able to call the uniqueSearch() function from inside the loop in Class Parent; but the above syntax does not seem to work. Anybody have any ideas? The real size of the uniqueSearch functions vary from 20-100 lines at this point, but might get bigger.