[fpc-pascal]Question on OOP programming...

Rainer Hantsch rainer at hantsch.co.at
Fri Nov 10 14:38:41 CET 2000

Hello, everybody!

I have a very interesting problem with my programming and I hope there is
somebody here who knows a solution.

I wrote a "Database Unit", which offers a basic oDB object for a special
form of text-based databases. This oDB includes currently everything I
need for ReadOnly operation. It is kept absolutely neutral, reads the
whole database file into a list of string on the heap, and allows to
access the fields by name (so I can add as many fields as I want with the
same oDB) and moving within this list.

Now I must add editing, and this includes Sorting. Sorting must be split
into Sort() which does the basic/physical sorting and KeyGen(), a function
which creates a sort string out of the currently selected data record.

To stay neutral at this level, I can only implement Sort() into oDB and
(possibly) a dummy version of KeyGen(), which must be overloaded later in
any way inside the client instance.

It is simple to overload a function from the client view by
defining it "virtual". From outside access this is ok, but I must
access this client version of KeyGen() from the parent!!!

Haw can I do that or something similar? I know that I can fix that with
workarounds, but this is not my target. I want to keep the internal list
of records "private" and to offer only methods for accessing it.

Please, if you know a solution, let me know!

Thanks in advance,

  Ing. Rainer Hantsch

      \\|//           Ing. Rainer HANTSCH  -  Hardware + Software
      (o o)           Your Partner - Your Supplier - Your Friend!
Ing. Rainer HANTSCH  |  e-Mail: office at hantsch.co.at
Khunngasse 21/20     |  www   : http://www.hantsch.co.at
A-1030 Vienna        |  Tel.  : ++43 - 1 - 7988538 0 
---------------------|  Fax   : ++43 - 1 - 7988538 18
** AUSTRIA **        |  Mobile: ++43 - 663 - 9194382

More information about the fpc-pascal mailing list