Activity Forums Salesforce® Discussions Can we have two methods in a class having same name and Webservice keyword with their declaration in Salesforce? Reply To: Can we have two methods in a class having same name and Webservice keyword with their declaration in Salesforce?

  • Adarsh

    Member
    January 12, 2018 at 6:34 am

    Hello Subhendu,

    NO, Within Salesforce we can't define two methods with the same name in a class. just because SOAP and WSDL do not provide good support for overloading methods. Consequently, Apex does not allow two methods marked with the web service keyword to have the same name. Web service methods that have the same name in the same class generate a compile-time error.

    Hop it helps 🙂