Is there a way to run a function after another functions completes? For example:
doSomething();
doSomethingElse();
i only want doSomethingE
There's no way to enforce this explicitly per se, but one idea is to have doSomething() return a value that doSomethingElse() accepts as a parameter:
retval = doSomething();
doSomethingElse(retval);
that way at least you prevent somebody from calling doSomethingElse() without at least supplying the argument it needs... of course, whether they get that argument from calling doSomething() is another issue. But this is a start.
Idea lifted from Code Complete.