Re: [fpc-pascal] Class reference doubt

2011-11-25 Thread Luiz Americo Pereira Camara
On 25/11/2011 07:50, Dimitri Smits wrote: so you have: type TMyObject=class(TObject) ... constructor Create; end; Yes TMyClass = class of TMyObject; //<-- important I guess Not important or necessary. I was using TClass from RTL = class of TObject ... procedure pr

Re: [fpc-pascal] Class reference doubt

2011-11-25 Thread Dimitri Smits
- "Luiz Americo Pereira Camara" schreef: > On 24/11/2011 19:34, Jonas Maebe wrote: > > In that case, you did not hit the same problem as the original > poster (your "I also hit this problem recently" is what triggered my > response). His problem was that if you call a non-virtual constructor

Re: [fpc-pascal] Class reference doubt

2011-11-24 Thread Luiz Americo Pereira Camara
On 24/11/2011 19:34, Jonas Maebe wrote: In that case, you did not hit the same problem as the original poster (your "I also hit this problem recently" is what triggered my response). His problem was that if you call a non-virtual constructor on a class reference variable, that the constructor i

Re: [fpc-pascal] Class reference doubt

2011-11-24 Thread Jonas Maebe
On 24 Nov 2011, at 23:00, Luiz Americo Pereira Camara wrote: > On 24/11/2011 08:02, Jonas Maebe wrote: >> >> On 24 Nov 2011, at 02:58, Luiz Americo Pereira Camara wrote: >> >>> On 23/11/2011 18:48, Jesus Reyes wrote: where I would expect: cls class is TFoo TObj.create TFoo.c

Re: [fpc-pascal] Class reference doubt

2011-11-24 Thread Luiz Americo Pereira Camara
On 24/11/2011 05:47, Graeme Geldenhuys wrote: On 2011-11-24 03:58, Luiz Americo Pereira Camara wrote: possible to get the expected behavior without forcing programmer to create a virtual constructor by using the new RTTI What has the "new RTTI" got to do with anything? Simply define TObj.Creat

Re: [fpc-pascal] Class reference doubt

2011-11-24 Thread Luiz Americo Pereira Camara
On 24/11/2011 08:02, Jonas Maebe wrote: On 24 Nov 2011, at 02:58, Luiz Americo Pereira Camara wrote: On 23/11/2011 18:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create I also hit this

Re: [fpc-pascal] Class reference doubt

2011-11-24 Thread Jonas Maebe
On 24 Nov 2011, at 02:58, Luiz Americo Pereira Camara wrote: On 23/11/2011 18:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create I also hit this problem recently Found that this is one

Re: [fpc-pascal] Class reference doubt

2011-11-24 Thread Graeme Geldenhuys
On 2011-11-24 03:58, Luiz Americo Pereira Camara wrote: > possible to get the expected behavior without forcing programmer to > create a virtual constructor by using the new RTTI What has the "new RTTI" got to do with anything? Simply define TObj.Create as virtual, and TFoo.Create as overridden.

Re: [fpc-pascal] Class reference doubt

2011-11-23 Thread Luiz Americo Pereira Camara
On 23/11/2011 18:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create I also hit this problem recently Found that this is one limitation of fpc. Under newer delphi it's possible to get the

Re: [fpc-pascal] Class reference doubt

2011-11-23 Thread Jonas Maebe
On 23 Nov 2011, at 22:48, Jesus Reyes wrote: > in the following example The output is: > cls class is TFoo > TObj.create > > where I would expect: > cls class is TFoo > TObj.create > TFoo.create > > ie the TFoo.constructor is not called, is this normal/expected? Yes. You have to use a virtual

[fpc-pascal] Class reference doubt

2011-11-23 Thread Jesus Reyes
in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create ie the TFoo.constructor is not called, is this normal/expected?, The documentation does clarify the situation: http://www.freepascal.org/docs-html/ref/refse31.ht