Reputation: 456
so I was just looking through the Code of our inventory management system and I saw some Snippet's of one of my Coworkers, all he does in some Functions is simply open them and insert a command in there for example
procedure TWerkStF.TBBtnStatiClick(Sender: TObject);
begin
inherited;
//
end;
so i am wondering when you should do something like that and when is it usefull, are there some benefits?
Upvotes: 2
Views: 510
Reputation:
We use such functions/procedures most times to tell other Co-Workers where they should not change anything, the reason for that is because some events are just not fitting the needs of some Modules, therefore we "warn" each other with empty Functions.
Sounds wiered, i know.
Upvotes: -1
Reputation: 613382
This is not useful, and has no benefits. Such a function can, and should, be removed.
The function in the question, by using inherited
, simply searches in the super classes for a function of the same name, and if one is found calls it. If one is not found then no action is performed. As a rule, such a function, one that only calls inherited
, does not modify the behaviour of the program. You can remove it without changing behaviour.
Upvotes: 3