This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271377 - instantiate a class dynamically
Summary: instantiate a class dynamically
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@php
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-27 07:10 UTC by abdelaziz_slim
Modified: 2017-08-27 07:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the method that instantiate classes dynamically (161.75 KB, image/png)
2017-08-27 07:10 UTC, abdelaziz_slim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description abdelaziz_slim 2017-08-27 07:10:29 UTC
Created attachment 165019 [details]
the method that instantiate classes dynamically

//when we have an abstract class like this
abstract class Controller{}

// and in another class we make a method to instantiate classes dynamically
private function addController($controller) {
    $object = new $controller($this->app);
}

# that shouldn't give us an error but this message appears
//==================================================
//Abstract class Controller can not be instantiated
//==================================================

thanks a lot for your great work;