delphi - Why ever declare members public instead of published? -


declaring members published has advantages on public:

  • ability read/write member in object insepoctor of ide
  • rtti , uses

so there ever benefit declaring members public instead of published? published have downsides? or should always declare members published, rule?


ps: not duplicate; read question , answers prior posting question. "possible duplicate" question explains difference between 2 keywords, doesn't gives guidance when either should used, or advantages/disadvantages of using either.

declaring published imposes storage cost because size of executable swollen contain rtti. declaring public avoids cost. it's unlikely ever matter, given immense size of modern delphi executables, containing huge amounts of code never executes.

for components can edited in object inspector, difference between public , published more significant. say, how component determines properties visible in object inspector. properties should visible there, others not. user "tlama" gives fine examples of properties need public, should not editable in object inspector: parent, handle , on.

beyond comes down opinion. it's entirely decide do.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -