Is this a bug?

Tom S h3r3tic at remove.mat.uni.torun.pl
Sat Jul 8 15:28:25 PDT 2006


freeagle wrote:
> I have a class BaseWindow
> {
> Dimension2D size()
>     {
>         return _size;
>     }
> 
> abstract void size(Dimension2D size);
> }
> 
> and derived class Win32Window : BaseWindow
> {
> void size(Dimension2D size)
> {
>     _size.set(size);
> }
> }
> 
> lets say i have a reference to class Win32Window. When i try to call 
> method _window.size(), compiler complains it doesn't match arguments 
> size(Dimension2D). Until i specify is to 
> (cast(BaseWindow)_window).size(). Why??

I don't remember the exact reason, but try aliasing 'size' from the 
BaseWindow's scope, like:

class Win32Window : BaseWindow {
void size(Dimension2D size) {
.....
}

alias super.size size;    // iirc
}


-- 
Tomasz Stachowiak  /+ a.k.a. h3r3tic +/



More information about the Digitalmars-d mailing list