Interview Question: Creating New Operator

Sample Question #253 (programming – C++)
Write C++ code to define a new exponentiation operator ** so that x**y returns pow(x,y).
This entry was posted in Sample Qs. Bookmark the permalink.

One Response to Interview Question: Creating New Operator

  1. Brett says:

    Haha, you can’t do it! "**" does not exist in C++ and C++ does not allow you to create a new operator symbol.
    Bonus question: can you overload the ^ (bitwise XOR operator) to do exponentiation? How?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s