Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Inheritance chain
Thu, May 15 2008 8:53 PMPermanent Link

Jeff Dunlop
TEDBQuery and TEDBTable are both documented as deriving from TDataSet, but the actual class inheritance chain appears to be broken at
TEDBDataSet and TEDBDBDataSet. Point being I can't a TEDBTable or TEDBQuery object of my choosing to a TDataSet pointer and navigate it.

Is there a reasonable workaround to this problem?
Fri, May 16 2008 4:09 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff

I've just tried

TDataSet(Users).First; and TDataSet(Users).Last;

with no problem. Users is a TEDBTable.

What are you trying?

Roy Lambert [Team Elevate]


Fri, May 16 2008 1:00 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff.

<< TEDBQuery and TEDBTable are both documented as deriving from TDataSet,
but the actual class inheritance chain appears to be broken at TEDBDataSet
and TEDBDBDataSet. Point being I can't a TEDBTable or TEDBQuery object of my
choosing to a TDataSet pointer and navigate it. >>

You most certainly can.  What is giving you the impression that the
components are not descended from TDataSet ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, May 18 2008 8:25 PMPermanent Link

Jeff Dunlop
class foo : public TDataSet
{
   foo(TDataSet *);
};

class bar : public foo
{
   bar(TDataSet *);
}

foo::foo(TDataSet *ds)
{
}

bar::bar(TDataSet *ds) : foo(ds)
{
}

I get [BCC32 Error] bar.cpp(17): E2285 Could not find a match for 'foo::foo(TEDBTable *)'

It doesn't appear to recognize that TEDBTable inherits from TDataSet and so doesn't find a match. When I try to view header declarations up the
chain, I wind up staring at the end of a file rather than the declaration for TEDBDBDataSet. I'll look into the workaround mentioned above and see
if it provides me with an alternative.
Sun, May 18 2008 8:32 PMPermanent Link

Jeff Dunlop
It looks like it's just in the constructor where matching up the tree something is off. Other than that, casting appears to work properly so I can
work with this, and if I've made some grievous error in the class inheritance or namespaces it'll probably come to me when I'd rather be
concentrating on something else.
Mon, May 19 2008 1:09 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< I get [BCC32 Error] bar.cpp(17): E2285 Could not find a match for
'foo::foo(TEDBTable *)'

It doesn't appear to recognize that TEDBTable inherits from TDataSet and so
doesn't find a match. >>

You're trying to cast a *descendant* of TDataSet to a TEDBTable, which is
not possible since they do not share the same single inheritance path.  You
can only cast objects to a different class type if that class type is
present in the direct ancestry of the object being casted.

For example:

TDataSet -> TEDBTable = Good
TEDBTable -> TDataSet = Good
TEDBTable -> TTable = Bad
TEDBTable -> TADOTable = Bad

--
Tim Young
Elevate Software
www.elevatesoft.com

Image