Skip to content

Exposed class method returns a class instance #17

Description

@Molochnik
TB = class 
end;

TA = class 
published
     function GetB:TB;
end;

var
     A: TA;
     B: TB;
...
function TA.GetB:TB;
begin
     Result:=B;
end;

TA and TB are exposed classes.
A is an exposed TA instance.
In the script

var
     B: TB;
begin
     B := A.GetB;//compile error function returns Variant instead of TB
end;

So A.GetB returns a value of type Variant instead of TB. How to convert it to TB?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions