I have created new objects with Dojo.declare. How to overload operator == for objects ?
I have created new objects with Dojo.declare. How to overload operator == for objects
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.
You can’t overload
==, but==has an implicit.toString()call, so whatever.toString()returns will allow you to effectively overload==(kinda):As for how to do this in Dojo, I don’t use Dojo, sorry, but the gist is that you get a reference to whatever object is creates and add
thatObject.prototype.toStringas in my example.