۲ mohammad dadkhah
میانبر ctrl + shift+m
جامعه پی اچ پی ایجاد شده در ۰۵ اردیبهشت ۱۴۰۱

سلان

تایم 40 دقیقه

استاد می‌ آیید با میانبر ctrl + shift+m در محیط کامندلاین بررسی کند که data ای وجود دارد یا نه

همون کد را می‌زنم ولی اون داده ای که به آبجکت پاس میده را نشان نمی‌دهد


interface Exportable {
    public function export();
}
abstract class Exporter implements Exportable{
    protected $data;
    protected $format;
    public function __construct($data)
    {
        $this->data= $data;
    }
    public function isValid()
    {
    }
}

و


include "Exporter.php";
class TextExporter extends Exporter 
{
    protected $format='.txt';
    public function export()
    {
       var_dump($this->data);
    }
}
$textExporter=new TextExporter(['mohammad','ali']);
$textExporter->export();

سلام دوست عزیز

این مورد با اکستنشن Code Runner قابل اجراست

بهترین پاسخ
محمد گازری ۰۵ اردیبهشت ۱۴۰۱، ۱۰:۳۰