[fpc-pascal] stuck with untyped pointer

José Mejuto joshyfun at gmail.com
Sat May 29 00:49:56 CEST 2010


Hello FPC-Pascal,

Saturday, May 29, 2010, 12:34:38 AM, you wrote:

>> TObject is the base class, it inherits from nobody. To make the whole
>> weel run a base class must exists which provide basic functionality
>> like Create/Destroy and other methods/events like "ClassName",
>> "InheritsFrom"; so if no class is specified it automatically inherits
>> from TObject.
AN> I see, and I suspected it was for these reasons, but allow me to say
AN> this is some sort of helper functions one might not need.
AN> "InhritsFrom", just like Delphi's "Is" (don't know if FPC has the same
AN> keyword, anyway) are things that can be dealt with the RTTI...

The classes in Pascal are more like "MFC" framework in MSVC. Most
functions does not eat a single byte of memory, RTTI are much more
memory expensive (maybe somebody corrects me?).

>> Pure class in the same idea does not exists in Pascal as in C, or at
>> least they do not exists a few time ago.
AN> classes in C are just mere structures, with no inheritance capability
AN> (i.e no VMT, AFAIK). I'm talking about C99, not C with classes 
AN> and-or-the-like-extensions to the language.
AN> In C++ no base class exists. I can define a "class TMyClass" descending
AN> from nothing, and have nothing else than it, as my _base_ class.

In Pascal that's a "Object" not a "Class". There was a recent thread
about the differences and why Classes are more used than objects.

AN> P.S.
AN> I'll probably read/reply tomorrow (ok, later today, GMT + 3...), as now
AN> I'm tired and wishing to go to bed ;-)

Have nice dreams...

-- 
Best regards,
 José




More information about the fpc-pascal mailing list