xApproxFunctionScalarEdgeBernstein
clang++ complain with 'xfem::xApproxFunctionScalarEdgeBernstein::getVal
' hides overloaded virtual functions.
'void getVal(const double & u, double & res) const
' is the one which hides:
virtual void getVal(const xGeomElem* geo_appro, const xGeomElem* geo_integ, xVector& ) const;
and
virtual void getVal(const xGeomElem* geo_appro, const xGeomElem* geo_integ, xVector&, const xValKey & )const;
from xApproxFunction
. It is not clear to me if this is done on purpose or not.
From my understanding this mean that if we call xfem::xApproxFunctionScalarEdgeBernstein::getVal
with those argument const xGeomElem* geo_appro, const xGeomElem* geo_integ, xVector&
the compilation will fails as this signature is hidden.
Use of using xApproxFunction::getVal;
in public part of this class remove warning and permit to do the above a priori.
A little example to choose the right solution:
class base
{
public:
virtual void init(void);
virtual void init(int i, int k); // (1)
virtual void init(int i); // (2)
};
class derived : public base
{
public:
void init(void) override; // (3)
void init(double i); // (4)
//using base::init; // (5)
}
int main(int argc, char *argv[])
{
derived o;
o.init(); // call (3)
o.init(1); // call (4) or (2) if (5) uncommented
//o.init(2,4); // if uncommented do not compile or compile and call (1) if (5) uncommented
o.init(2.3); // call (4)
clang++ warning are:
In file included from main.cc:2:
./main.h:13:14: warning: 'derived::init' hides overloaded virtual functions [-Woverloaded-virtual]
void init(double i);
^
./main.h:5:22: note: hidden overloaded virtual function 'base::init' declared here: different number of parameters (2 vs 1)
virtual void init(int i, int k);
^
./main.h:6:22: note: hidden overloaded virtual function 'base::init' declared here: type mismatch at 1st parameter ('int' vs 'double')
virtual void init(int i);
^
1 warning generated.