IonicWind Software

IWBasic => Object Oriented Programming => Topic started by: Pewing on April 20, 2009, 08:03:43 PM

Title: Question? is there a way to pass an Istring to a method of a CLASS?
Post by: Pewing on April 20, 2009, 08:03:43 PM
When I try and pass an Istring parm to a method of a class, I get the "No appropriate conversion exist" error.  I thought version 1.7 allowed for this.
example:
CLASS Istr
   DEF anIstring [3000] as istring
   DECLAIRE SetIstr (arg [3000]:istring)
ENDCLASS

SUB Istr::SetIsrt (arg [3000]:istring)
   anIstring = srg
ENDSUB

$MAIN
  DEF Myobj as istr
  DEF Test [3000] as Istring
  test = assgn_it
  Myobj.SetIstr(test)  <-- Error
END

This is cramping my style, if you know what I mean

Peter
"I hit the ESC key , so why am i still here?"
Title: Re: Question? is there a way to pass an Istring to a method of a CLASS?
Post by: Ionic Wind Support Team on April 20, 2009, 08:13:52 PM
Just use the string type as the parameter, in this case it is interchangeable as all strings are passed by reference.

CLASS Istr
   DEF anIstring [3000] as istring
   DECLARE SetIstr (string arg)
ENDCLASS


SUB Istr::SetIsrt (string arg)
   anIstring = srg
ENDSUB

Paul.
Title: Re: Question? is there a way to pass an Istring to a method of a CLASS?
Post by: Pewing on April 20, 2009, 08:23:48 PM
Thanks, I also just discovered that if I send the paramater with a [ 0 ] element that seems to also work. I guess the compiler needed the first element to get the reference address. exp:  Myobj.SetIstr(test [ 0 ]) 
Title: Re: Question? is there a way to pass an Istring to a method of a CLASS?
Post by: Allan on April 21, 2009, 02:39:05 PM
QuoteDECLAIRE

Spelling? DECLARE