The assignment operator in base class does not seem to be available in derived class. Given this code:
#include <iostream>
class A{
int value;
public:
A& operator=(int value){
this->value = value;
return *this;
}
};
class B : public A{};
int main(){
B b;
b = 0; // Does not work
return 0;
}
GCC 6.4 says:
error: no match for 'operator=' (operand types are 'B' and 'int')
What is happening?
See Question&Answers more detail:os