Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php exttends

class B {
    public function method_from_b($s) {
        echo $s;
    }
}

class C {
    public function method_from_c($s) {
        echo $s;
    }
}

class A extends B
{
  private $c;
    
  public function __construct()
  {
    $this->c = new C;
  }
    
  // fake "extends C" using magic function
  public function __call($method, $args)
  {
    $this->c->$method($args[0]);
  }
}


$a = new A;
$a->method_from_b("abc");
$a->method_from_c("def");
Comment

php exttends

class B {
    public function method_from_b($s) {
        echo $s;
    }
}

class C {
    public function method_from_c($s) {
        echo $s;
    }
}

class A extends B
{
  private $c;
    
  public function __construct()
  {
    $this->c = new C;
  }
    
  // fake "extends C" using magic function
  public function __call($method, $args)
  {
    $this->c->$method($args[0]);
  }
}


$a = new A;
$a->method_from_b("abc");
$a->method_from_c("def");
Comment

PREVIOUS NEXT
Code Example
Php :: php if form fails keep data 
Php :: https://stackoverflow.com/questions/58589741/angular-8-hide-divs-and-show-div-on-button-click 
Php :: laravel ffmpeg color filter effects 
Php :: Access directory above php 
Php :: WordPress Emojis abschalten 
Php :: delete request php-salesforce-rest-api 
Php :: avoid web crawling in Laravel 
Php :: @parent laravel 
Php :: php decrement variable 
Php :: laravel resourece type 
Php :: how to print * symbol in c++ 
Php :: how to insert last id from crud grocery codeigniter 
Php :: php like button counter 
Php :: wordpress function _() not working 
Php :: redirect back in codeignitor 
Php :: gan_sql 
Php :: Print all before characters once string found | matched string return 
Php :: laravel ailed: WebSocket opening handshake was canceled 
Php :: date fomat in php 
Php :: How to get ID and other string in url 
Php :: Validating data received via the Web App php 
Php :: php calculate age as float 
Php :: download yii 1.1 
Php :: laravel Difference between save, fill, create in laravel eloquent 
Php :: laravel dispatch execute multiple 
Php :: php get docblock with reflection 
Php :: Round Number Up 
Php :: MethodNotAllowedHttpException 
Php :: chart trong laravel 
Php :: laravel connection timed out 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =