Activity Forums Salesforce® Discussions Overloading in Apex

  • shradha jain

    Member
    August 30, 2018 at 5:09 am

    Hello Madhulika,

    Overloading in Apex programming alludes to the capability to make use of a lone identifier to distinguish various techniques for a class that contrasts in their in sequence virtues and gives way to the function parameters. Overload techniques are generally, for the most part, used especially when they convincingly carry out a comparable enterprise yet to some extent only one of its kind type of arrangement of function parameters.

    It is an idea which is used to steer totally away from the overindulgence of programming code where a comparable line of attack can be easily utilized in a number of circumstances when coupled with a few alternate arrangements of function parameters.

    The real strategy that you had originally developed gets called in during the runtime to settle the assemble time, along these very lines balancing a very strategic distance from all the runtime mistakes that can occur. Overloading is the method that gives code the lucidity it requires, takes out its multilateral quality, and upgrades the runtime implementation.

    Thanks.

  • shariq

    Member
    September 17, 2018 at 9:49 pm

    Hi,

    I think you need this -

    Overloading Web Service Methods. SOAP and WSDL do not provide good support for overloading methods. Consequently, Apex does not allow two methods marked with the webservice keyword to have the same name. Web service methods that have the same name in the same class generate a compile-time error.
    Hope this helps.

  • Parul

    Member
    September 18, 2018 at 4:42 am

    Hi

    Overloading happens at compile-time while Overriding happens at runtime:
    Overloading is being done in the same class while for overriding base and child classes are required Overriding is all about giving a specific implementation to the inherited method of parent class.
    Performance: Overloading gives better performance compared to overriding. The reason is that the   binding of overridden methods is being done at runtime.
    Private and final methods can be overloaded but they cannot be overridden and in Apex, all methods and classes are final by default. So to override a class or a method we have to used virtual and override keyword.

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos