Subclass method -distorted now put again

June somewhere at so.com
Thu May 8 04:09:50 PDT 2008


Ary Borenszweig wrote:

>> Completely lost now .
>> So much extraneous stuff
>> 
>>>> textBoxes["foo"] = new Text("hi!");  using 'dwt.widgets.Text'
>>>> ,,this
>> expects a composite parent and an integer style so this does not
>> work
>> 
>> I understand the need to  store the names point you are making but
>> surely I can override the 'dwt.widgets.Text's '  setText(text)
>> function some way?
> 
> You can override it by defining a method with the same name and
> signature:
> 
> class YourClass : Text {
> 
>    override void setText(char[] text) {
>      // your code...
>    }
> 
> }
> 
> However, if you define a method "void setText(char[] name, char[]
> text)" in YourClass, that's not an override: that's an overload. And
> I'm not sure, but in that case, if you still want to be able to use
> the old setText, you need to make an alias for it:
> 
> alias setText setText;

Thanks thats what I am seeking to do .I will try it out



More information about the Digitalmars-d-learn mailing list