Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php calling abstract static function from inside abstrac class

abstract class AbstractFoo{
    public static function foo() {
        throw new RuntimeException("Unimplemented");
    }
    public static function getFoo(){
        return static::foo();
    }
}

class ConcreteFoo extends AbstractFoo{
    public static function foo(){
        return "bar";
    }
}

echo ConcreteFoo::getFoo();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #calling #abstract #static #function #abstrac #class
ADD COMMENT
Topic
Name
4+1 =