F
Frederick Gotham
Is there any way to prevent hiding of a base class function? I want the
derived class to add an overload of the function, rather than hide the
base class one. The following snippet demonstrates what I'm after:
class Type1 {};
class Type2 {};
class Base {
public:
void Func( Type1 )
{
;
}
};
class Derived : public Base {
public:
void Func( Type2 )
{
;
}
};
int main()
{
Derived derived_obj;
Type1 type1_obj;
derived_obj.Func(type1_obj); /* Any way to make this work? */
/* Instead of having to do: */
static_cast<Base&>(derived_obj).Func( type1_obj );
}
derived class to add an overload of the function, rather than hide the
base class one. The following snippet demonstrates what I'm after:
class Type1 {};
class Type2 {};
class Base {
public:
void Func( Type1 )
{
;
}
};
class Derived : public Base {
public:
void Func( Type2 )
{
;
}
};
int main()
{
Derived derived_obj;
Type1 type1_obj;
derived_obj.Func(type1_obj); /* Any way to make this work? */
/* Instead of having to do: */
static_cast<Base&>(derived_obj).Func( type1_obj );
}