Why a variable is assigned value directly instead of calling set functions in some cases?

In UE4 docs, I noticed some codes like:

PointLight1 = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLight1"));
PointLight1->Intensity = DesiredIntensity;
PointLight1->bVisible = true;
RootComponent = PointLight1;

I know PointLight1 has function SetVisibility, so why not use this function? I saw many similar codes assigning value directly instead of calling function.

I am curious about why and want to know which way is more appropriate in formal codes.

Thank you in advance!