function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
111111 

i got the hello.cls,and then how can i use method of Message.cls?

i get the error message
Method is not visible: [s.Message].setM1(String)
 
i got the hello.cls,and then how can i use method of Message.cls?
 
 
 
for example
 
file 1 (hello.cls)
 
global class Hello {
 WebService static String sayHelloWorld() {
       
        Message message = new Message();
        message.setM1('d');
        return  message.getM1();
 }
}
 
 
 
file 2  ( Message.cls)
public class Message {
 String M1 = 'Hello world';
 String M2 = 'Hello USA';
 
 void setM1(String argM1) {
        M1 = argM1;
    }
   
    void setM2(String argM2) {
        M2 = argM2;
    }
   
    String getM1(){
        return M1;
    }
   
    String getM2(){
        return M2;
    }
}
SuperfellSuperfell
The method setM1 needs to be public.

You might want to invest a little time reading some of the apex docs.
http://wiki.apexdevnet.com/index.php/Apex_and_Visualforce#Apex
111111
Thank you for your help
 
i want to invest a little time reading some of the apex docs.
my English is poor ,i'm sorry always asking the simple question.:smileysad: