-----------------------------------------------------
type TSomeClass = class
function SomeRoutine:STRING; virtual;
end;
type TSomeDescendant = class (TSomeClass)
function SomeRoutine:STRING; virtual;
end;
function TSomeClass.someRoutine:STRING;
begin
someRoutine:='class';
end;
function TSomeDescendant.someRoutine:STRING;
begin
someRoutine:='descnedant';
end;
----------------------------------------------------
Now somewhere else I will have something like:
----------------------------------------------------
var sc:TSomeClass;
begin
sc:=TSomeClass.create;
MessageDlg( sc.SomeRoutine , mtInformation, [mbOk], 0);
sc.destroy;
sc:=TSomeDescendant.create;
MessageDlg( sc.SomeRoutine , mtInformation, [mbOk], 0);
sc.destroy;
end;
----------------------------------------------------
Both calls to SomeRoutine return the parent class's string ("class" ). This
kind of code works fine in BP7, so what is it about Delphi that prevents the
redefined routine from being called?
-------------------------------------------------------
http://members.home.net/dave.t.rudolf
http://members.home.net/stonemason
Dave,
In order to override the base class' routine, you must use the override
directive. So, your derived class' declaration will look something like
this:
type TSomeDescendant = class (TSomeClass)
function SomeRoutine:STRING; override;
end;
I believe that should take care of it.
Damion
-------------------------------------------------------
http://members.home.net/dave.t.rudolf
http://members.home.net/stonemason
"Damion Moyer-Sims" <dam...@teleport.com> wrote in message
news:39833fd9_2@dnews...