I am having a problem with my virtual methods in a derived class. Here are my (simplified) C++ classes.
class Base
virtual method accept( MyVisitor1* v ) { /*implementation is here*/ };
virtual method accept( MyVisitor2* v ) { /*implementation is here*/ };
virtual method accept( MyVisitor3* v ) { /*implementation is here*/ };
class DerivedClass
virtual method accept( MyVisitor2* v ) { /*implementation is here*/ };
The following use causes VS 2005 to give: "error C2664: 'DerivedClass::accept' : cannot convert parameter 1 from 'Visitor1*' to 'Visitor2 *'".
DerivedClass c;
MyVisitor1 v1;
c.accept(v1);
I was expecting the compiler to find and call Base::accept(MyVisitor1) for my DerivedClass as well. Obviously this is not working, but I don't understand why. Any ideas?
Thanks,
Paul