Subject RE: [IBO] Common Typecast
Author IBO Support List
There isn't a common ancestor between these two.

What you could do is write an interface that you would put in it everything
you need these components to do and then make sub-classed versions of
TIB_Query and TIBOQuery to include your interface. Then, your common
routines will just request the interface from each one and then interact
with the interface that will take care of doing what should be done
regardless of whether it is a TIB_Query or TIBOQuery.

Let me know how this works for you.

Jason


-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Jack Cane, Ph.D.
Sent: 08 December 2012 01:41 PM
To: ibobjects@yahoogroups.com
Subject: [IBO] Common Typecast

Need to write a single procedure which I can call with two (perhaps more,
later) different ibo types.


Currently I have two:
proc1( query: TIBOquery; etc.);
proc2( cursor: TIB_cursor; etc.);


Can I combine these into a single procedure that uses a common ancestor?
proc( iboObj : tAncestor; etc. );


Thinking I can then typecast the query/cursor in the calling method:


var crs : TIB_cursor
crs: := TIB_cursor.create(self);
.
.
.
proc2( tAncestor( crs ), etc. );


Can that work? What would be the correct ancestor type?


Best,
jwc






[Non-text portions of this message have been removed]



------------------------------------

___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links