[fpc-pascal] Out of scope method?

Marcos Douglas B. Santos md at delfire.net
Thu Apr 6 17:01:23 CEST 2017


On Thu, Apr 6, 2017 at 11:48 AM, Ryan Joseph <ryan at thealchemistguild.com> wrote:
>
>> On Apr 6, 2017, at 9:42 PM, Marcos Douglas B. Santos <md at delfire.net> wrote:
>>
>> Lose type checking?
>> Of course not. You still use the same language, interfaces, classes...
>>
>> Don't confuse "New, the function" with "New, a method in a class".
>
> I should say that you need to have a matching interface for all your classes, and if not then you’ll lose type checking.

Yes, you need.
IMHO, casting is not a good option to use in object-oriented programming.

> IAction needs to have all the methods in TAction for type checking to work right?
>

In fact is the opposite:
TAction needs to have all methods that IAction have.
This TAction class in the example is not the same class in RTL.

You shouldn't have so many methods in just one class.
So, it is simple implement all methods of an interface.

Best regards,
Marcos Douglas



More information about the fpc-pascal mailing list