Subclass method -distorted now put again

BLS nanali at nospam-wanadoo.fr
Wed May 7 06:28:53 PDT 2008


June schrieb:
> Ary Borenszweig Wrote:
> 
>> June escribió:
>>> dwt.widget.Text has method
>>>  
>>> void setText  (char[] string); 
>>> Sets the contents of the receiver to the given string.
>>>
>>> In my application I use many of these text boxes each with a name so I need a function 
>>>
>>> void setText(char[] name, char[] text){
>>>    name.setText(text);}
>> name.setText(text) ?
>>
>> But name is of type char[]
>>
>>> How can  I bring this into my program ?
>> Maybe you could show what you do now, and how you would like to have it 
>> if you were able to do what you want. I don't understand what you are 
>> trying to do. :(
> 
> 
> In a class 'Room'
> I make a text box called  "speaker', and another called 'radio' etc
> Text speaker = new Text;
> 
> all blank atm
> 
> In another module  'town' I create instance of 'room' and 
> now I want to set the text in each
> speaker.setText("Wallplate");
> radio.setText("Valves")
> 
> So Text class has  method  'setText(char[])
> 
> In 'town' I want to make another method like 
> setText(name[],text[]);
> 
> different parameters to setText () in Text- I need to find out how to do it please?

Hi June,

class room
{
   setText(char[] roomtext)
   {
    // print or whatever you wanna do with roomtext
   }
}

class town : room
{
  setText(char[] roomtext, char[] towntext)
  {
   .setText(roomtext); // have a look at the dot in front of setText, 
calls room setText()
   // do something with towntext
  }
}

hth bjoern


More information about the Digitalmars-d-learn mailing list