Are the classes transferred to the heirs of the operation overloaded in the base class?
2 answers
As I understood from the question and comments, you wondered whether operator=() from the base class would be available in the class of the heir. No, it will not be available. The reason is that the compiler implicitly creates a copy assignment operator that hides all inherited overloads operator=() . To solve this problem, you can use the using -om:
struct A{ int i; void operator =(int value){ i = value; } }; struct B : A{ using A::operator =; }; There should be no problems with other operators.
- those. writing so I, in the class of the heir, say to use the operators of the parent class? what I was looking for. - Konstantin Fomin
As far as I understand from the question, you are interested in whether overloaded functions (that is, having several signatures) are transferred to the heirs. They are passed if public inheritance is used (as are non-overloaded functions):
struct Base { int foo(int a); int foo(double a); }; struct Derived : public Base { // Наследует int foo(int a); // Наследует int foo(double a); }; But this rule does not apply to constructors, destructors and assignment operators. They must be defined explicitly, or (starting with C ++ 11) explicitly inherited - otherwise the compiler will automatically generate them, overlapping the parent ones. Related to this question, which you gave the link in the comments.
Конструктор_Производного_Класса (/*параметры*/) : Конструктор_Базового_Класса ( /*параметры*/) { }- Alex.B