We have a few Subs (like a WriteErrorToLog and some AutomatedTesting) that I’d like to make optional in case we want to reuse a component.
I’d like to be able to do something like if AddressOf(Sub) is valid then execute Sub.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The structured way of doing this is to make the sub/function part of an interface. You can now let two distinct classes implement that interface, one providing empty implementations and the other one providing the real logic.
Now you can simply assign whatever class you need and call the method. If you assigned the empty implementation class, no code will be executed.