I'm new to PHP OOP, and understand that "Warning: Creating default object from empty value" comes from an object not being initialised before writing, but I'm struggling to understand why I'm getting the error with the following code.
Please help!
class A { public $varA; }
class B {
public $varB;
function __construct(){ $varB = new A; }
}
$obj = new B;
$obj->varB->varA = "Whatever";
Aa constructor? Also, protected properties can't be set from outside the class IIRC.$this