#1 2015-09-01 05:39:41

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

tsqlrecord.createcopy

bonjour ab,

problably i'm trying to do something of wrong (as often i do), but i'd like your opinion.

i've defined an ancestor class derived from tSQLRecord : tClass1.
This class is a common ancestor for other classes : tAClass1, tBClass1 etc.
In a unit i've defined some common tasks on tClass1.

I pass to this unit instances of tAClass1, tBClass1 as a  parameter , fData (obviously defined of type tClass1) and the exact derived class type in an other parameter  fDataClass.

All works fine except that when i  do a copy of such instance in this way : fDataCopy := fData.CreateCopy as fDataClass.  On destroying it, i obtain a memory leak.

My question is : i cannot use createcopy in this a way and must define methods on each derived class, using the exact class (instead of fData of type tClass1), or the record destructor should anyway release correctly the data ?

tx

Offline

Board footer

Powered by FluxBB