4

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

asked Nov 2, 2010 at 12:19

2 Answers 2

7

Yes, always.

answered Nov 2, 2010 at 12:20
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.

answered Nov 2, 2010 at 12:21

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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.