Hi All, According to http://www.freepascal.org/docs-html/ref/refsu72.html,
the overload keyword is mostly optional and for delphi compatiblity only. But on Oct. 27, Sven replied my question about hide a public constructor in base class: >> I don't understand why this does not work: >> f := TFileStream.Create; >> >> I know that TFileStream's Create require a file name parameter, but as TFileStream is >> inherited from TObject, which has a Create without parameter. This is why I feel that it >> is possible to HIDE a public constructor from ancestor. > No, I don't think so. If you want users to use the original constructor as well you'd need to > declare yours as "overload". If it would be possible to call > TFileStream.Create without > parameters then the instance would be in an inconsistent state, so only calling the > constructor with arguments should be possible (which is the case for TFileStream. > So this is definitely by design. Now my question is: in this case overload keyword DO make a difference? Then, how to overload? e.g.: In base class: constructor Create; In child class: constructor Create(param1:...; param2: ...): overload; i.e. overload does NOT require functions to have same parameter list or return type? Also, it does not require the overload keyword in base class? Otherwise programmers need to modify the base class, which is not good. Thanks, Xiangrong
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal