Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Ancestor Class visibility and Class Incompatibility

I am working on a project that consists of a suite of applications written in D5. I estimate that there are around 2 million lines of code in all.
The database used is MySQL, and for various reasons which I won't go into, I am writing the needed code to migrate to Firebird SQL 2.x.
Database access code is largely restricted to a single unit, with two other dependent units playing a lesser role.
So, for example, there are classes such as TMySQLConn (DB Connection component), TMySQLQuery (Query component), TMySQLFields (collection of TMySLQFields, which is a property of TMySQLQuery), etc.
The source code is littered with calls this database code, such as:
with TMySQLQuery.Create (of the order of 698 such calls)
The intention is to avoid having to change this code in any way, so I've written a parallel class library, for want of a better term, which uses the IBXpress Components as ancestors for the components needed, with the same names. a #DEFINE at the start of the unit, tells the compiler which code to compile.
I'm now attempting to compile the code of the principal application, and am encountering a variety of problems, most of which are easily solvable, often with help from this forum.
I've now encountered something that has me baffled.
In the source code which I do not want to change, are calls to TMySQLField. In the database class library I've written, TMySQLField inherits from TField. When I compile the code, the error message says their is a class incompatibility between TMySQLField and TField. It looks like the compiler is looking up the inheritance chain and identifying my TMySLQField as of type TField, which it is since TMySQLField inherits from TField.
Note also that TMySQLField and TField are not identical.
There are a few methods in TMySQLField that do not exist in TField, and there are calls to these methods in the application source code. In other words, TMySQLField TField.
Short of changing the TMySQLField to TField in the application source code, something I am very reluctant to do, is there any other way around the problem?
Regards,
Morman McFarlane

Comments

  • pritaeaspritaeas Posts: 274Member
    : Short of changing the TMySQLField to TField in the application
    : source code, something I am very reluctant to do, is there any other
    : way around the problem?
    : Regards,
    : Morman McFarlane

    Is it possible that there is a naming conflict somewhere ? Maybe there is another TField it is looking at.

    I don't know your code, but perhaps it is possible to use a typecast.

    TMySqlField(MyField) or TField(MySqlField)
  • DelphiScribeDelphiScribe Posts: 2Member
    : : Short of changing the TMySQLField to TField in the application
    : : source code, something I am very reluctant to do, is there any other
    : : way around the problem?
    : : Regards,
    : : Morman McFarlane
    :
    : Is it possible that there is a naming conflict somewhere ? Maybe
    : there is another TField it is looking at.
    :
    : I don't know your code, but perhaps it is possible to use a typecast.
    :
    : TMySqlField(MyField) or TField(MySqlField)
    Thanks, already tried that, and it doesn't work. It raises an exception.
    Regards,
    Norman
Sign In or Register to comment.