Here are some additional resources to explore.
- Subclasses
- Apex supports subclasses, allowing you to create a class that extends another class. The subclass inherits all the functionality of that parent class. It can also have additional methods and member variables, and can override the behavior of existing parent class methods.
- Static Methods and Instance Methods
- Static methods are methods declared with the static keyword. They’re generally useful as utility methods and never depend on a particular instance member variable value. Because you can only associate a static method with a class, the static method cannot access any instance member variable values of the class. Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.
- Instance methods and member variables are used by an instance of a class, that is, by an object. Instance member variables are declared inside a class, but not within a method. Instance methods usually use instance member variables to affect the behavior of the method.
- Security of Executing Code
- Unlike code snippets run in the execute anonymous window in the Developer Console, Apex code in classes (and triggers) runs in system context. Object and field level security settings are not enforced. This means that an Apex class has access to all data in your organization. Make sure you don’t inadvertently delete data or expose sensitive data. With great power, comes great responsibility! Note that you can enforce sharing permissions of the currently logged-in user by declaring a class with thewith sharing keyword.
No comments:
Post a Comment