On 2013-02-14 06:49, cal wrote:
And a related question:
class A
{
void foo(int i){}
void foo(Tuple!(int) i){}
}
class B: A
{
override void foo(int i){}
}
int main()
{
auto b = new B;
b.foo(tuple(5));
}
This fails to compile. Why can't B use A's tuple overload of foo()? If I
do this:
class B: A
{
override void foo(int i){}
void foo(Tuple!(int) i){} // no override keyword is deprecated
}
The compiler warns about not using the override keyword, so it must be
seeing the function?
The base class and the subclass have different overload sets. You need
to bring in "foo" from the base class into the overload set in the
subclass. You can do this by using an alias:
class B : A
{
alias A.foo foo;
}
--
/Jacob Carlborg