>Yes. The problem is that they are hidden by class' own assignment
operator (even if it's compiler-defined).
#include <iostream>
struct B {
B& operator=(const B&) {
std::cout << "B=B\n"; return *this; }
};
struct D : B {};
int main() {
D d1, d2;
I am hoping that Santa Claus will bring me the C++ Standard for Christmas, but
until then I will have to quote TCPPPL 2nd Ed. pg 593...
"The assignment function operator=() must be a nonstatic member function; it is
not inherited"
Maybe this is an error or has changed?
struct Base
{
void operator=(int)
{
}
};
struct Derived : Base
{
};
int main()
{
Derived d;
d = 3;
return 0;
}
The above produces an error on both Comeau and VC++.
If I introduce a using declaration into struct Derived...
struct Derived : Base
{
using Base::operator=();
};
Comeau accepts d = 3 but VC++ still does not.
I don't know which one is correct.