4

Is operator overloading for classes and structs always resolved at compile-time?

2 Answers 2

7

Yes, always.

Sign up to request clarification or add additional context in comments.

2 Comments

I wondered because apparently it isn't in Delphi, because there are speed differences
@Lort: This sort of information should be part of your question.
3

Yes. Only dynamic type-specific behavior achievable in C++ is through virtual member functions.

2 Comments

And note that operator overloads can be virtual member functions. The overload is still resolved at compile-time, though, so the answer is correct. It's the override which is dynamic.
@Steve - nice distinction & explanation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.