Forum > General

When to use published keyword in Classes

(1/1)

soerensen3:
Dear All,

I know what the published keyword does. For Classes (and interfaces and objects) compiled with {$M+} it generates RTTI information. For component development it is really simple. You use it when you want a value to be visible in the object inspector. But if you don't develop components do you ever use published where you do not use RTTI yourself, just in case someone want to use it with RTTI? Are there any other reasons for a property to be published?

ASerge:
I think it's useless to make properties published without using RTTI. But RTTI, of course, can be used not only with components.

Leledumbo:

--- Quote from: soerensen3 on November 10, 2017, 08:59:16 pm ---But if you don't develop components do you ever use published where you do not use RTTI yourself, just in case someone want to use it with RTTI? Are there any other reasons for a property to be published?

--- End quote ---
RTTI is surely not only for components. I use it in my ORM (as many other ORM does) to automap properties to database columns.

Navigation

[0] Message Index

Go to full version