I searched for answers a lot, but only found stuff around questions of whether one can write a class in another class and stuff like that.
So there is the first document, which is:
Document1:
class MyClass1 {
private $myAttribute1;
__construct(){
this->myAttribute1 = 'blabla';
}
}
now calling in the same document
$myObject1 = new MyClass1();
works totally fine in NetBeans.
Meanwhile when I build another document, lets call it Document2, and build another class there, which is intended to use MyClass1, Netbeans tells me there is a problem:
Document2:
myClass2 {
$myAttribute2 = new myClass1();
}
so this does not work in my NetBeans, just tells me 'unexpected new'. How can I use MyClass1 in myClass2 since this way does not work?
__construct().myClass2is in a separate file, be sure toincludethe file containing themyClass1.