Is there anything that protected members or functions can be used for?
You cannot inherit from a union so there are no children that can access it. Does it provide a functional use or is just there because removing it was hassle?
Is there anything that protected members or functions can be used for?
You cannot inherit from a union so there are no children that can access it. Does it provide a functional use or is just there because removing it was hassle?
protected
in a union
becomes completely equivalent to private
, but this allowance does no harm and avoids extra special case handling and extra differences between union
and struct
/class
(which are described all together in the standard).
Honestly, I think it's possible to use protected
in a union
just not to add the umteenth special case to the standard for the sake of it; maybe it didn't even come to mind to the standard committee to differentiate this behavior, since it's quite a bizarre corner case but does no harm as it's currently specified.