> On Apr 15, 2016, at 7:03 PM, Sven Barth <pascaldra...@googlemail.com> wrote:
> 
> Again, you're fighting against design principles of the language. It's just 
> as if you'd want to have virtual class methods in C++…

Agreed. Everyone has their own list of things they want their language to do I 
guess. Maybe I got spoiled with the typeless “id” type from Objective-C that 
let me have little work arounds for things like this. Not having a dictionary 
type after using PHP hurts also. ;)

Here’s another option I thought of. If the type casting was of a serious 
quantity doing this could save time and improve readability of code. 

unit unitA;

interface

type

class TClassA
private
 FClassBObject: TObject;
public
 procedure SomeProc;
end;

implementation

uses unitB;

type
 TClassAHelper = class helper for TClassA
  function aClassBObject: TClassB;
 end;

function TClassAHelper.aClassBObject: TClassB;
begin
 result := TClassB(FClassBObject)
end;

procedure TClassA.SomeProc;
begin
 aClassBObject.OtherProc;
end;

end.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to