for example we have
BaseClass myBaseObject
InheritedClass myInheritedObject
and 2 overloaded methods
void Do(BaseClass tmp)
{ DoA();}
void Do(InheritedClass tmp)
{ DoB();}
What would this do?
Do((BaseClass) myInheritedObject);
And is it common technique to put DoA() under BaseClass, and DoB() under InheritedClass and override DoA(), and merge the 2 Do() into 1?
void Do(BaseClass tmp)
{return tmp.DoA()}
The first – the second overload isn’t applicable, because the compile-time type of the argument is
BaseClassinstead ofInheritedClass, and there’s no implicit conversion fromBaseClasstoInheritedClass.