What operators cannot be virtual?

M

moleskyca1

What operators cannot be virtual and why? I looked at FAQ and found
nothing.

I think there are operators that cannot be virtual, but I don't know
why?
 
V

Victor Bazarov

What operators cannot be virtual and why?

Operators 'new' and 'delete' and 'new[]' and 'delete[]', because they
are essentially "static" (although not declared as such).
I looked at FAQ and found
nothing.

That's because it's not a Frequently Asked Question.
I think there are operators that cannot be virtual, but I don't know
why?

I believe you can think that because you suspect that you might not know
everything there is to know about C++. Quite understandable. I am the
same way, although not about overloaded operators.

V
 
T

tolgaceylanus

FYI, the assignment operator can actually be declared virtual.
But this is unlikely to be useful since each class will have it's own
assignment operator with different type of parameter that has the same
type of the class itself.

Tolga Ceylan
 
J

Jim Langston

Victor Bazarov said:
What operators cannot be virtual and why?

Operators 'new' and 'delete' and 'new[]' and 'delete[]', because they
are essentially "static" (although not declared as such).
I looked at FAQ and found
nothing.

That's because it's not a Frequently Asked Question.
I think there are operators that cannot be virtual, but I don't know
why?

I believe you can think that because you suspect that you might not know
everything there is to know about C++. Quite understandable. I am the
same way, although not about overloaded operators.

V

I find that hard to believe. I don't think I've seen a question you can't
answer V.
 
D

Diego Martins

Jim said:
Victor Bazarov said:
What operators cannot be virtual and why?

Operators 'new' and 'delete' and 'new[]' and 'delete[]', because they
are essentially "static" (although not declared as such).
I looked at FAQ and found
nothing.

That's because it's not a Frequently Asked Question.
I think there are operators that cannot be virtual, but I don't know
why?

I believe you can think that because you suspect that you might not know
everything there is to know about C++. Quite understandable. I am the
same way, although not about overloaded operators.

V

I find that hard to believe. I don't think I've seen a question you can't
answer V.

C++ is huge!!! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top