By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,479 Members | 1,729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,479 IT Pros & Developers. It's quick & easy.

using declaration and miranda functions

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.