[Gambas-user] Bug in constructor?

danielcampos at ...282... danielcampos at ...282...
Mon Nov 10 15:06:19 CET 2003


Hi, Benoît (and company)! 
 
 I was trying to add an optional parameter for 'Socket' constructor, so 
I did it in that way: 
 
_new method: 
 
BEGIN_METHOD(CSOCKET_new,GB_STRING sPath;) 
 
  /* some stuff */ 
 
  if (STRING(sPath)) 
  { 
  	printf("sPath! --> %s\n",STRING(sPath)); 
  } 
 
END_METHOD  
 
And in method definition: 
 
... 
GB_METHOD("_new", NULL, CSOCKET_new, "[(sPath)s]"), 
... 
 
 
 Well, I created a little test program : 
 
Private MySock As Socket 
.... 
Public Sub Button1_Click() 
 
	MySock=New Socket("teststring") As "MySock" 
 
End Sub 
 
Well, after executing it, OK, it appears "teststring" at console (see _new method), 
but then I changed it to see if it really was an optional parameter: 
 
	MySock=New Socket As "MySock" 
 
To my surprise it appeared it console "MySock", that is, the event handler 
was passed like a parameter to the constructor! 
 
I also tried MySock=New Socket() As "MySock" but It didn't work 
at all (Syntax error) 
 
... 
 
Regards, 
 
Daniel Campos 
 

-------------------------------------------------------------
NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar...
Web/Wap : www.netcourrier.com
Téléphone/Fax : 08 92 69 00 21 (0,34 € TTC/min)
Minitel: 3615 NETCOURRIER (0,16 € TTC/min)





More information about the User mailing list