On Wed, Jan 20, 2016 at 11:23:27AM +0100, Sven Barth wrote: > Note: "overload" is only necessary if you have multiple methods of the same > name with different parameters. What you probably meant is "override", but > even that is only necessary if a method in the parent was declared as > "virtual". For constructors this isn't normally necessary, except if you > want to use class variables to instantiate the class. E.g. > > === code begin === > > type > TNonceClass = class of TNonce; > > var > c: TNonceClass; > o: TNonce; > begin > c := TSomeSubNonce; > o := c.Create; > end. > > === code end === > > In this example if the constructor in TNonce isn't declared as virtual (and > the on in TSomeSubNonce not as override) the TNonce.Create will be called, > otherwise TSomeSubNonce will be called.
Thanks Sven. Haven't had a need to do stuff like this with Object Pascal for now, but for past several years I have been programming in Smalltalk so this looks familiar. :-) > The memory area of a class instance is by default always initialized with > 0s. So in this case "pn" will contain zeroes and "filled" will be "false". > Sidenote: Strings will be '', objects, interfaces and dynamic arrays will > be Nil. > > Classes are *always* allocated on the heap. If you want to control whether > something is allocated on the stack or the heap you need to use records or > the Turbo Pascal-style objects. Got it. Cheers. Pierce _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal