what if return returned subclasses

Dennis dkorpel at gmail.com
Wed Oct 20 23:57:01 UTC 2021

On Wednesday, 20 October 2021 at 22:42:43 UTC, Adam D Ruppe wrote:
> That is, it is converted to the base class before passed to the 
> function, but since it is marked `return` anyway, the compiler 
> knows it is the same instance, so the static type passed in is 
> retained in the return value.

No, `return` doesn't imply that the parameter is returned. Even 
if the function is `pure` and there's only one parameter, it 
could still return a new object or a field of the parameter.

More information about the Digitalmars-d mailing list