#include<iostream>
#include<complex>
using namespace std;
class Base
{
public:
virtual void f( int iParam)
{
cout << "Base::f(int)" << endl;
};
virtual void f( double dParam)
{
cout << "Base::f(double)" << endl;
};
};
class Derived: public Base
{
public:
void f( complex<double> Param)
{
cout << "Derived::f(complex)" << endl;
};
};
int main()
{
Base b;
Derived d;
Base* pb = new Derived;
b.f(1.0);
d.f(1.0);
pb->f(1.0);
delete pb;
return 0;
}
输出结果:
Base::f(double)
Derived::f(complex)
Base::f(double)