471,052 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 1175
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
reply views Thread by leo001 | last post: by

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.