How many of these operators are inherited by heirs class

Overloadable operators
+ - * / = < > += -= *= /= << >>
<<= >>= == != <= >= ++ -- % & ^ ! |
~ &= ^= |= && || %= [] () , ->* -> new
delete new[] delete[]


Basically, anything is inherited, unless the operators are overloaded to be virtual or pure.
The assignment operator (=) is not inherited.

All others are.
Thanks,

None of the compound ones has been inherited including the (=).
They are simply not found in the heir with on compiling or with linker when re-reclared
in the heir.
Except for the (<<) operator.
if by compound ones you mean +=, -=, etc. Those all are inherited normally.

This works just fine:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class A
{
public:
    A& operator += (int a) { return *this; }
};

class B : public A
{
};

int main()
{
    B b;
    b += 5;  // works just fine
    return 0;
}


= is the only operator that isn't inherited.
Thanks again,
Yes, it does. Mine is spread over a little.
Topic archived. No new replies allowed.