Public Methods

Public means the method can be used by any Apex in this application or namespace. As other class methods, a public method can be called by triggers and other classes.

Calling methods of other classes enables code reuse, reduces the size of your triggers, and improves maintenance of your Apex code. It also allows you to use object-oriented programming.

You can extend a class to provide more specialized behavior. A class that extends another class inherits all the methods and properties of the extended class. In addition, the extending class can override the existing virtual methods by using the override keyword in the method definition. Overriding a virtual method allows you to provide a different implementation for an existing method. This means that the behavior of a particular method is different based on the object you’re calling it on.

Currently, we have only one public method in the package:

global virtual void createRelatedData(List<__Activity__c> activityList,Map<Id, __Activity__c> oldMap) {
code_block
}
  • The global class is GlobalActivityService.

  • The first parameter is the list of records of CTPHARMA_Activity__c.

  • The second parameter is the previous values of records of CTPHARMA_Activity__c.

Here is an example of how to extend the existing class and override its public method:

public class ClassName extends GlobalActivityService {
public override void createRelatedData(List<__Activity__c> activityList, Map<Id, __Activity__c> oldMap) {
your_code_block
}
}

See also:

``