Activity Forums Salesforce® Discussions What is Overloading in Salesforce Apex? Reply To: What is Overloading in Salesforce Apex?

  • Parul

    September 22, 2018 at 3:57 pm

    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.