delphi - Why do TObject.AfterConstruction and BeforeConstruction have public visibility? -


today, 1 simple question came mind when had override tobject's beforeconstruction method:

why tobject methods afterconstruction , beforeconstruction have public visibility?

i expected them protected. reason aren't?

i can't imagine valid purpose call afterconstruction or beforeconstruction without calling constructor or destructor of class. you?

a previous question asked why other methods public instead of protected, , the answer @ point needed called utility functions weren't attached class.

tobject.afterconstruction called such utility function, system._afterconstruction. if (strict) protected, standalone function wouldn't have access method.

all methods of tobject public.* can find rationales explain why each method public, @ point, suspect underlying reason given method being public others are, too.

once delphi released methods public, reduction in visibility have risked breaking existing code.


* except getdisposed , checkdisposed, reason. they're relatively new, compared bulk of tobject.


Comments