473,390 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

What operators cannot be virtual?

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?

Aug 14 '06 #1
4 1518
mo********@yahoo.com wrote:
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 14 '06 #2

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

Aug 14 '06 #3
"Victor Bazarov" <v.********@comAcast.netwrote in message
news:eb**********@news.datemas.de...
mo********@yahoo.com wrote:
>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.
Aug 15 '06 #4

Jim Langston wrote:
"Victor Bazarov" <v.********@comAcast.netwrote in message
news:eb**********@news.datemas.de...
mo********@yahoo.com wrote:
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!!! :-)

Aug 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Andy Jarrell | last post by:
I'm trying to inherit from a specific class that has an overloaded operator. The problem I'm getting is that certain overloaded operators don't seem to come with the inheritance. For example: ...
12
by: c++novice | last post by:
1--Can operators be virtual? 2--What is the difference between an operator= returning a refernce Vs a value?
3
by: N4M | last post by:
Dear, I have problems with overloaded operators ++() and --(). MSVC++ 6.0 compiler gives errors, one is shown as below: " c:\data\c++\mygraphs\graph.h(182) : error C2555: 'CGraphNodeIter::++' :...
17
by: Anoob | last post by:
Can we consider () unary operator when calling a function, in exps eq. f(), ( 1 + 2). But when we call function f( 10 ) it is a binary operator. Even if we pass f( 10, 20) as we are using ,...
5
by: Action | last post by:
does it works like ordinary virtual method?? coz I find that child class can't invoke the event of the parent class. class parent { public virtual event SomeDelegate SomeChanged; } class...
25
by: tsaar2003 | last post by:
Hi Pythonians, To begin with I'd like to apologize that I am not very experienced Python programmer so please forgive me if the following text does not make any sense. I have been missing...
13
by: olanglois | last post by:
Hi, I am trying to derive a new class that will add new functions but no new data members and the base class has overloaded operators (+,-,+=,-=,etc...) returning either (Base &) or (const Base)...
5
by: Shak | last post by:
Hi all. I was led to believe that static methods were not inherited by their subclasses (and since that makes sense, rightly so). However, a subclass I've written is using it's (abstract)...
2
by: gyarnell | last post by:
Just ran into a problem upgrading from GCC 2.96 to GCC 3.3.2. There is a bug somewhere, could be in 2.96, could be in 3.3.2, could be in the code I'm compiling. Here's a minimal example class A {...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.