Re: [fpc-pascal] How to know if a class implements a method

2007-05-18 Thread Matt Emson
> So, at this moment I know that I can: > > 1. Use a safe, magic and efficient way, but I need to know if it exists; > 2. Create a "light" instance using vfooclass.NewInstance method; > 3. hack the vmt. > > Which approach do you use? I have worked with a bespoke OPF a few years ago. The way we got

Re: [fpc-pascal] How to know if a class implements a method

2007-05-18 Thread Joao Morais
Hello Matt, thanks for your fast input. Matt Emson wrote: Any idea how I know if a class, in a class pointer, overrides a virtual method? Eg: vfooclass := tboo1; // vfooclass doesn't implement sample. vfooclass := tboo2; // vfooclass implements sample. You need to implement a virtual m

Re: [fpc-pascal] How to know if a class implements a method

2007-05-18 Thread Matt Emson
> Any idea how I know if a class, in a class pointer, overrides a virtual > method? Eg: > vfooclass := tboo1; > // vfooclass doesn't implement sample. > > vfooclass := tboo2; > // vfooclass implements sample. You need to implement a virtual method, even if it does nothing. Are you sure you're

[fpc-pascal] How to know if a class implements a method

2007-05-18 Thread Joao Morais
Hello, Any idea how I know if a class, in a class pointer, overrides a virtual method? Eg: tfooclass = class of tfoo; tfoo = class procedure sample; virtual; end; tboo1 = class(tfoo) end; tboo2 = class(tfoo) procedure sample; override; end; ... vfooclass := tboo1; // vfooclass doesn'