Hello!

Hello!

For the first time in 25 years of programming, I need a protected or private static property and I do not think that Delphi has the kind of mechanism I am looking for built in.

Scenario:
I have a configuration class that is created on the fly because it's useless to have it hang around. The problem is that I need an array where to store some of its data permanently, even when the object has been destroyed, because it will hold interfaces that are relatively expensive to create and that do not change much.

Solutions so far:

The first thing I thought of is to make a private array in the implementation and go with that. It is kind of OK, except that I really don't like leaks and this would be a flood :)

The second thing I thought of is a class constant, but that is even worse, because even if I declare it in the "private" section, it is still accessible by external code due to its "class" status.
Sigh.

So far, the only solution that kind-of works is the former.

Any ideas?

Thanks!

A



Comments