Re: [fpc-pascal] Calling overriden method using TMethod

2015-07-30 Thread Joao Morais
On 30/07/15 15:05, Sven Barth wrote: Am 30.07.2015 19:00 schrieb "Joao Morais" >: > > tbar2 inherits from tbar1 and 'go' is a virtual method. v1.go calls the tbar2 implementation as expected but tm(m1)() does call tbar1.go. As expected. Is there a nice and safe

Re: [fpc-pascal] Calling overriden method using TMethod

2015-07-30 Thread Sven Barth
Am 30.07.2015 19:00 schrieb "Joao Morais" : > > tbar2 inherits from tbar1 and 'go' is a virtual method. v1.go calls the tbar2 implementation as expected but tm(m1)() does call tbar1.go. As expected. Is there a nice and safe way to use v1 instance's VMT in order to call the inherited method? In the

[fpc-pascal] Calling overriden method using TMethod

2015-07-30 Thread Joao Morais
Hello, in the following sample: ==>>>== ... type tm = procedure of object; var v1: tbar1; m1: tmethod; begin v1 := tbar2.create; try v1.go; m1.code:=@tbar1.go; m1.data:=v1; tm(m1)(); finally freeandnil(v1); end; end. ==<<<== tbar2 inherits from