RR,
I guess you need to write an aditional method:
class Derived extends Base
{
function Insert()
{
// does some different stuff
parent::Insert( ); // then calls method from base class
}
functon baseInsert()
{
parent::Insert( );
}
}
then call $der->basInsert();
Alternativily you could rename the Direved::Insert () method:
class Derived extends Base
{
function extendedInsert( )
{
// does some different stuff
$this->Insert(); // then calls inherited method
}
}
These two solutions will give different polymorphisms for Insert(). I
mean, if you can have arrays like:
$polymorhicArra y = array( new Base(), new Derived(), new Base() );
and you would want to do:
forEach ($polymorhicArr ay as $baseOrDerived)
$baseOrDerived->Insert();
Then i guess only one of the above solutions will do what you want.
Greetings,
Henk Verhoeven,
www.phpPeanuts.org.
RR wrote:
I have two classes:
class Base
{
function Insert()
{
// does stuff
}
}
class Derived extends Base
{
function Insert()
{
// does some different stuff
parent::Insert( ); // then calls base class
}
}
Now, in main line code I want to do this:
$der = new Derived();
$der->parent::Insert (); // I want to call the base class's Insert
method - doesn't work
$der->Base::Insert() ; // this doesn't work either
Is it possible to access a hidden parent class method with a child class
object in PHP4?
thanks,
RR