functionality, you need to cast the object reference to a more specific typebut what type?
forName method can create a new class type at run time, the way your code uses that class is still checked by the compiler, before your program has a chance to run. This restricts your code to using the new class and its instances only in terms of a superclass or interfaces that the compiler can check. For example, suppose that myPackage.myClass in the previous code fragment implements the Runnable interface, which contains the single method run.
Related Questions
- My org relies on email-to-case functionality but I do not know how to use Apex with the EmailMessage object type. Is it possible to execute Apex code on incoming or outgoing emails in cases?
- Okay, so an int is a value type, and a class is a reference type. How can int be derived from object?
- functionality, you need to cast the object reference to a more specific typebut what type?