i'm not sure if i'm getting this right, but i still remember java allowing me to cast an object to another type as long as their ancestors are the same?
I can't seem to do this in delphi, the compiler doesn't seem to understand the methods and attributes of each object even after I've casted them. What's wrong?
I'm trying to figure out how to stick two database query objects under the same name as illustrated :
qry : TObject;
if(callType = 'A') then
//casting qry as a TOraQuery object :
qry := TOraQuery.Create(nil);
qry := commonObj.GetConnection('DATABASE_A');
qry.SQL.Add('DELETE FROM TEST1');
if(callType = 'B') then
//casting qry as a TADOConnection object :
qry := TADOConnection.Create(nil);
qry := commonObj.GetConnection('DATABASE_B');
qry.SQL.Add('DELETE FROM TEST2');