[fpc-pascal] Virtual object methods

Ryan Joseph genericptr at gmail.com
Thu Jun 27 23:56:49 CEST 2019



> On Jun 27, 2019, at 5:53 PM, Ben Grasset <operator97 at gmail.com> wrote:
> 
> If you specifically need inheritance (combined with virtual methods) you should probably just use classes, because doing it with objects will require heap allocation regardless. 
> 

Heap allocate how so? Calling the constructor seems to fix this and puts the VMT table on the stack (I think anyways). Btw I’m doing this specifically as testing for a possible “advancedobjects” mode switch and the only reason to use objects is for inheritance on the stack (otherwise records or classes).

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list