473,396 Members | 2,070 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,396 software developers and data experts.

Problem Blocking operator=

I wrote:

class Parent
{
...
private:
virtual Parent& operator=(const Parent& parent);
};

class Child : public Parent
{
...
private:
virtual Child& operator=(const Child& parent);
};

In neither case was the operator=() defined.

With gcc 3.2, this failed to link, with undefined references
for both operator=(), notwithstanding that it was used nowhere
in my code.

The problem was corrected by removing both "virtual".
Is this expected, or is it a problem with the compiler?

Can anyone cite chapter & verse?

Thanks,
Mike.
Jul 22 '05 #1
2 1441
"Mike - EMAIL IGNORED" <m_*************@yahoo.com> wrote...
I wrote:

class Parent
{
...
private:
virtual Parent& operator=(const Parent& parent);
};

class Child : public Parent
{
...
private:
virtual Child& operator=(const Child& parent);
};

In neither case was the operator=() defined.

With gcc 3.2, this failed to link, with undefined references
for both operator=(), notwithstanding that it was used nowhere
in my code.

The problem was corrected by removing both "virtual".
Is this expected, or is it a problem with the compiler?

Can anyone cite chapter & verse?


10.3/8: A virtual function declared in a class shall be defined,
or declared pure (10.4) in that class, or both; [...]

Victor
Jul 22 '05 #2
"Mike - EMAIL IGNORED" <m_*************@yahoo.com> wrote in message
news:3F***************@yahoo.com...
I wrote:

class Parent
{
...
private:
virtual Parent& operator=(const Parent& parent);
};

class Child : public Parent
{
...
private:
virtual Child& operator=(const Child& parent);
};

In neither case was the operator=() defined.

With gcc 3.2, this failed to link, with undefined references
for both operator=(), notwithstanding that it was used nowhere
in my code.
I think that's normal for virtual functions. By definition, the call of a
virtual function is decided at run-time, so I suppose the easiest
implementation is to make sure they are there, just in case.
The problem was corrected by removing both "virtual".
Is this expected, or is it a problem with the compiler?


'virtual' is inappropriate anyway because the argument type is different in
each case. Typically, assignment operators are not virtual.

DW

Jul 22 '05 #3

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

Similar topics

4
by: Matt Chaplain | last post by:
Hi there. I'm writing a program that uses the Telnet protocol over TCP/IP sockets. Of course, that has no bearing here, so I'll rephrase that in Standard C++ :) In essense, I'm trying to...
24
by: neo | last post by:
Hi, I have a problem to set a JDBC connection as READ UNCOMMITED. setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED) This is causing lots of blocking on tables and update or...
1
by: Hal | last post by:
SQL2K, sp3 Active Server Pages front-end I am having a blocking problem with a spid executing a stored procedure that does no updates. When I look at the locks the blocking spid has, some of...
5
by: Ritesh | last post by:
Hi All, According to my observation using SP_WHO2 in my database, some INSERT statements are getting blocked by SELECT statements. Though the blocking SELECT statement is having ReadPast hint,...
7
by: David Sworder | last post by:
Hi, I'm developing an application that will support several thousand simultaneous connections on the server-side. I'm trying to maximize throughput. The client (WinForms) and server communicate...
3
by: Matthew King | last post by:
Hi all I've written a asynchronous socket client class, but i've found that in order to consume it I have to use events, and cannot simply for example SocketClient client = new...
0
by: alnsaisrinivas | last post by:
Hi I've a problem with I/O blocking on my serial port at this particular scenario... 1.I've developed a driver to communicate with some device using Serial Comm (overlapped I/O). 2.I'm able to...
1
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but...
4
by: Neil | last post by:
Having trouble with inserting a record into a table. It's a list of names. But, for some reason, it won't take a particular name. When a user tries to enter a name into the table, the system hangs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.