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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.