Jump to content

Michael Taylor

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by Michael Taylor


  1. On 9/27/2023 at 9:08 AM, Pat Foley said:

    I thinking to 'upgrade' to Enterprise  I been able to debug over one screen vs two screens, 11.3 is as lithe and cat quick like D3.    

    Is the upgrade from Pro to Enterprise worth it? I think it might be nice for Linux development if it worked on Raspberry Pis. Can I ask what you want to upgrade to Enterprise for?


  2. I have a fairly simple class where the only members are an enumerated type and an object whose members are two integers and a string. Nothing that needs memory management, so I wanted to call my constructor "From" instead of "Create" to signify that no memory allocation takes place, and Free won't be necessary. However, this doesn't seem to work. I created an ObjectDictionary<ItemType, Span> and populated it with Span.From(...) and none of the objects seemed to be properly created (they were just junk data). When I replaced the From constructor with a From class function, it worked properly.

     

    Can someone tell me what is happening in the class function that isn't happening in the constructor that is making it work?

     

    Thank you!

     

    { Some things left out for brevity }
    
    type
    	Color = class
        public
        	property Red: Integer;
            property Green: Integer;
            property Blue: Integer;
            constructor From(r, g, b: Integer); overload;
            constructor From(hexVal: String); overload;
        end;
    
    type
    	ItemType = (A, B, C);
    type
    	Span = class
        public
        	property Color: Color;
            property item: ItemType;
            constructor From(item: ItemType, color: Color);
        end;
    
    implementation
    
    constructor Span.From(item: ItemType, color: Color);
    begin
    	Color := color;
        Item := item;
    end;
    
    { The class function I replaced the constructor with.  This works. }
    class function Span.From(item: ItemType, color: Color): Span;
    begin
    	result := Span.Create;
        result.Color := color;
        result.Item := item;
    end;

     

×