We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › overload a class
Page Index Toggle Pages: 1
overload a class (Read 344 times)
overload a class
Jul 10th, 2006, 6:55pm
 
I'm wondering whether is not allow do a overload in a class insite to Processing. Like this:

class fetch{
void setProp(String user, Integer password, String server){
 type = "normal";
}
void setProp(String user, Integer password, String server, Integer port){
 type = "type1";
}  
}

the error is:

C:/DOCUME~1/MARCAN~1/CONFIG~1/Temp/build14491.tmp/Temporary_5968_5201.java:2:1:2
:53: Semantic Error: No applicable overload for a method with signature "setProp(java.lang.String, int, java.lang.String, int)" was found in type "fetchmail". Perhaps you wanted the overloaded version "void setProp(java.lang.String user, java.lang.Integer password, java.lang.String server, java.lang.Integer port);" instead?

thanks

Mar Canet
http://www.derivart.info/



Re: overload a class
Reply #1 - Jul 10th, 2006, 7:27pm
 
You want "int" not "Integer" I think.
Re: overload a class
Reply #2 - Jul 11th, 2006, 12:57am
 
Yes, I'm little bit stupid.

I confirm that is possible overload a class:

class fetchmail {
 
void setProp(String user, int password, String server){
 type = "normal";
}
void setProp(String user, int password, String server, int port){
 type = "complex";
}
}

Thanks a lot JohnG

Mar
Page Index Toggle Pages: 1