Virtual inheritence (I guess)
Posted on 2001-07-09
I have two form which must have the same public procedure, so I decide to create an abstract base class for them to inheritence like this.
TAbstractForm = class(TForm)
function ShowX: integer; virtual; abstract;
The two subclass forms look like this
TFormX = class(TAbstractForm)
function ShowX: integer; virtual;
function TFormX.ShowX: integer;
result := 217;
I then want to call a procedure with either of the two forms like this
procedure TForm1.ShowMyForm( Form: TAbstractForm );
the actual call
ShowMyForm( FormX );
I get this strange memory error when performing the last call. I guess because Delphi tries to execute ShowX of the abstract base class.
How do I handle this problem ?
BTW this was just a quick example I put together, so perhaps some details is forgotten or left out.