468,468 Members | 2,717 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,468 developers. It's quick & easy.

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 1134
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by Daniel | last post: by
10 posts views Thread by Christopher Benson-Manica | last post: by
15 posts views Thread by Robert Allan Schwartz | last post: by
21 posts views Thread by JKop | last post: by
10 posts views Thread by Kobu | last post: by
29 posts views Thread by shuisheng | last post: by
1 post views Thread by INeedADip | last post: by
15 posts views Thread by vaib | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.