Am 13.11.2013 02:57, schrieb Xiangrong Fang:
Hi,

Is it OK to use "inherited" in any instance method? i.e.

It is OK to do this:

procedure TChildClass.DoIt;//override
begin
  inherited DoIt;
end;

But is it ok to do this:

procedure TChildClass.SomethinElse;//NOT DoIt
begin
  inherited DoIt;
  //... ...
end;

I tried, it seems ok, but I am not sure, because I had a strange access violation in my code which I cannot reproduce in simplified version of the code, so I suspect this might be an invalid use and "correct by coincidence"?
You can always use "inherited" to call a method of the given name in the next parent class that has such a method (Note: there are a few exceptions: If no such methods exist (compile time error) and if the method is abstract (also compile time error))

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to