[fpc-pascal] A better way?
ryan at thealchemistguild.com
Fri Apr 15 14:20:46 CEST 2016
> On Apr 15, 2016, at 7:03 PM, Sven Barth <pascaldragon at 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.
TClassAHelper = class helper for TClassA
function aClassBObject: TClassB;
function TClassAHelper.aClassBObject: TClassB;
result := TClassB(FClassBObject)
More information about the fpc-pascal