Good afternoon,
I am coding some TFoo and TBar . They have several methods that require calling the swithcing function TFoo.switch and TBar.switch .
TBaseFooBar = class strict private FNumConfig: Word; protected procedure Switch; end;
This superclass has an FNumConfig private field that describes the number of PCI cards. The Switch method uses a function from some library:
procedure TBaseFooBar.Switch; begin tmkselect(FNumConfig); end;
I would like to ask you if there is a way to call the Switch super function before doing any DoSomethingWithFoo() or DoSomethingWithBar() respectfully? I mean something like this
TFoo = class(TBaseFooBar ) { FNumConfig: Word; // this number declares the number of a PCI card} public @Switch // before this method procedure DoSomethingWithFoo1(); // ... @Switch // and before this one procedure DoSomethingWithFooN(); // before this one there is no calling of Switch function NotSwitching(); end;
And the TBar class
TBar = class(TBaseFooBar ) { FNumConfig: Word;
I know about a simple method:
procedure TFoo.DoSomethingWithFoo1(); begin Switch(); // and another stuff. end;
but I would like to write all this in one place - in the declaration of classes.
source share