Objects are obsolete and shouldn't be used anymore. Well, the difference between records and objects is that objects can have methods, while records cannot. That's all.Originally Posted by chronozphere
Objects are obsolete and shouldn't be used anymore. Well, the difference between records and objects is that objects can have methods, while records cannot. That's all.Originally Posted by chronozphere
In D2006+ records can contain methods can (.NETism needed for for..each), and in FPC objects are not formally deprecated.Originally Posted by Brainer
However, except some really rare cases (e.g. emulation of statically allocated iterator objects is one), one should indeed use classes.
That's why I use Objects. They must not be removed from Pascal, they have to be there because of backwards compat.Originally Posted by Brainer
Marmin^.Style
Hmm, I'm not that sure. :? I think they can only contain methods related to operator overriding. Correct me if I'm wrong.Originally Posted by marcov
no they may have functions, constructors, procedures, but not destructorsOriginally Posted by Brainer
From brazil (:
Pascal pownz!
I don't get it then. Why does Borland say objects are obsolete, while they allowed records to have its own functions and even a constructor?Originally Posted by arthurprs
Is there any reason i should use records if objects do same and can have procedures? Is object packed?
don't know =|Originally Posted by Brainer
From brazil (:
Pascal pownz!
Records with methods are nice in the sense that no advanced memory management is required to chug it around at random places in ram. Objects contain certain type information to my knowledge. The compiler will also place helper functions for objects to allocate and free objects and such
I can only wait for FPC to add similar functionality
Peregrinus, expectavi pedes meos in cymbalis
Nullus norvegicorum sole urinat
Bookmarks