I am getting a parsing/syntax error on the 4th line of the following script; it says “unexpected identifier “function_construct”, expecting 'function” or “const”…
class Paint_1
{
private string $color ;
function_construct ( string $hue=‘Blue’ )
{
$this->color=$hue ;
}
public function SETCOLOR (string $c)
{
$this->color=$c ;
}
public function GETCOLOR()
{
return $this->color ;
}
}
class Paint_1
{
private string $color;
public function __construct(string $hue='Blue')
{
$this->color = $hue;
}
public function SETCOLOR(string $c)
{
$this->color = $c;
}
public function GETCOLOR()
{
return $this->color;
}
}
Don’t know what you’re trying to do, but you had the constructor wrong it should be written __construct
and you had the wrong quotes in $hue='blue'
I think or it could had just been the way it was copied over.
1 Like
Your code Strider64
, is a perfect solution.