I currently have a working class called calcWindow that uses a few facts to hold info consulted from a physical fact file.
To try and improved the speed of this program I now wish to consult the facts then move these facts into a chainDB with a btree index. The chainDB and btIndex stuff I know how to do.
For many years I have never known how to share or inherit a fact declaration between two classes as I now wish to write a separate class that will from now on, handle my facts database but in a btree database.
classfacts% ID Lat Log Weight Distance
gift:(integer,real,real,real, real).
How and where do I declare this gift fact template/type so that I can use instances of this fact in both places. The existing calcWindow class and my new soon to be written btree class that will hold a btree database of the pool of gift. I still need to access this gift template/type in my existing calcWindow as I create small collections of gifts for optimisation purposes.
Or do I simply duplicate the declaration in both places and hope to remember to change both if the fact format changes.
You cannot share a fact database between two class implementations. You can duplicate the declarations but that is a bad idea as it will eventually lead to inconsistencies. I will suggest that you place your fact database in a dedicated class and access the data through this class from both your new classes.
I will also suggest that you consider using the collection classes (see Collection Library) rather than "playing" with chainDB and B+-trees.