Click to See Complete Forum and Search --> : abstract class InterfaceClass


stew
08-20-2005, 01:57 PM
hey there i'm not on a computer that i can test php scripts on at the moment otherwise i would try it myself....

is it possible to have an abstract class that extends another class?

stew

Weedpacket
08-21-2005, 01:28 AM
Yup; subclasses of an abstract class don't need to define every method the abstract class declares. In fact they don't need to define any.
abstract class foo
{
abstract function foo_this();
abstract function foo_that();
}

abstract class bar extends foo
{
function foo_this(){echo 'BANG!';}
// foo_that() is still abstract
}

If I leave the "abstract" off "abstract class bar", PHP terminates with a fatal error to the effect that bar is still an abstract class.