I’d like to augment the Function object to do more operations while constructing a new object.
Is it possible?
I’d like to augment the Function object to do more operations while constructing a
Share
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.
There is no way to modify the Function prototype so that you can intercept calls to a function. The closest you are going to get to this is to add a method that you can call in place of a constructor. For example:
Alternatively you could write a function that you would call to build a constructor: