Niestety __CLASS__ nie działa, gdyż w momencie:
<?php class foo { function getClass() { return __CLASS__; } // coś tam } class foo2 extends foo { //coś tam } ob=new foo2; ?>
wypisuje foo

<?php class foo { function getClass() { return get_class($this); } // coś tam } ?>
<?php class foo { function getClass() { return get_class($this); } // coś tam } class foo2 extends foo { //coś tam } ?>
<?php class foo { function make() { $klasa=get_class($this); $klasa::makeSth; $klasa::makeSth1; $klasa::makeSth2; } // coś tam } class foo2 extends foo { //coś tam function makeSth() { } function makeSth1() { } function makeSth2() { } } $ob=new foo2(); ?>
<?php class foo { function make(){ $this->makeSth(); $this->makeSth1(); $this->makeSth2(); } // coś tam function makeSth(){ return false; } function makeSth1(){ return false; } function makeSth2(){ return false; } } class foo2 extends foo { //coś tam function makeSth(){ } function makeSth1(){ } function makeSth2(){ } } $ob=new foo2(); ?>
<?php class foo { function make() { $klasa=get_class($this); $klasa::makeSth; $klasa::makeSth1; $klasa.='admin_'; $admin=new $klasa(); $admin->Sth; } // coś tam } class foo2 extends foo { //coś tam function makeSth() { } function makeSth1() { } function makeSth2() { } } $ob=new foo2(); ?>