473,461 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using declaration and miranda functions

Someone asked me about the construct below:

class Base {
public:
// all other elements redacted
Base& operator=(const Base&);
};

class Derived : public Base {
public:
using Base::operator=;
};

My response was first, "don't do that". Followed by the observation
that 7.3.3 seems to allow this, but what I believe happens is that you
still get the compiler-provided Derived::operator=, with an override for
an RHS of const Base&. Is this correct?

Thanks,

red floyd

Jul 10 '06 #1
2 1270
red floyd wrote:
Someone asked me about the construct below:

class Base {
public:
// all other elements redacted
Base& operator=(const Base&);
};

class Derived : public Base {
public:
using Base::operator=;
};

My response was first, "don't do that". Followed by the observation
that 7.3.3 seems to allow this, but what I believe happens is that you
still get the compiler-provided Derived::operator=, with an override
for an RHS of const Base&. Is this correct?
Two operators are _overloaded_. "Override" only applies to virtual
functions. Other than that, yes.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 10 '06 #2
Victor Bazarov wrote:
red floyd wrote:
>Someone asked me about the construct below:

class Base {
public:
// all other elements redacted
Base& operator=(const Base&);
};

class Derived : public Base {
public:
using Base::operator=;
};

My response was first, "don't do that". Followed by the observation
that 7.3.3 seems to allow this, but what I believe happens is that you
still get the compiler-provided Derived::operator=, with an override
for an RHS of const Base&. Is this correct?

Two operators are _overloaded_. "Override" only applies to virtual
functions. Other than that, yes.

V
Victor, thanks for correcting my verbage... I mean overload, of course.
Jul 10 '06 #3

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

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
10
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org ...
15
by: Robert Allan Schwartz | last post by:
I've heard the phrase "Miranda function" used to refer to the 6 member functions supplied by the compiler: default constructor copy constructor destructor operator= operator& const operator&
21
by: JKop | last post by:
Is this them all?: class Dummy { public: Dummy() {} Dummy(const Dummy& original) { }
6
by: Daniel Nichols | last post by:
I've noticed that in a C module (.c, .h file combination) that if you create a function's definition before it is used in other functions than a declaration is not necessary. I believe if the...
10
by: Kobu | last post by:
My question is about the use and meaning of the terms "declaration" and "definition" as it pertains to the C language. I've read sources that mix the two up when talking about such things as...
29
by: shuisheng | last post by:
Dear All, The problem of choosing pointer or reference is always confusing me. Would you please give me some suggestion on it. I appreciate your kind help. For example, I'd like to convert a...
1
by: INeedADip | last post by:
What is the difference between: function setupGrid( param ){......} and setupGrid = function( param ){......} Are there any advantages to doing one over the other?
15
by: vaib | last post by:
hi to all.i'd like to know the actual difference between variable declaration and definition.it would be very helpful if anyone out there wud help me out with this thing.i'm writing here after here...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.