delphi - Why would a class need an empty method to be called to register it? -
i'm evaluating existing dependency injection library delphi, , settled on delphidicontainer because of simplicity - needs single unit file!
however, there 1 thing don't understand — in this example file @ bottom:
initialization //with lines linked include actual code services tcsvdataservice.register; tpaddeddataservice.register;
these register
methods empty, but, if comment out 2 lines in initialization section, dicontainer.get('dataservice') tdataservice
fail.
why? these empty methods for?
the delphi compiler smart , try eliminate unused code when compiling/linking code, compiler's point of view, implementation classes (eg, tcsvdataservice
) in example not used anywhere in program , eliminated, these empty method callings there prevent happening.
Comments
Post a Comment