Suppose I have the following Class
:
public class Yup{
public class YupException extends Exception{}//END YupException
public static void debugTestException(){
YupException TestException=new YupException('This is only a test.');
system.debug(system.LoggingLevel.ERROR,'TestException = '+TestException );
system.debug(system.LoggingLevel.ERROR,'TestException.getCause() = '+TestException.getCause() );
system.debug(system.LoggingLevel.ERROR,'TestException.getMessage() = '+TestException.getMessage() );
system.debug(system.LoggingLevel.ERROR,'TestException.getTypeName() = '+TestException.getTypeName() );
system.debug(system.LoggingLevel.ERROR,'TestException.getStackTraceString() = '+TestException.getStackTraceString() );
system.debug(system.LoggingLevel.ERROR,'TestException.getLineNumber() = '+TestException.getLineNumber() );
}//END DebugTestException()
}//END Yup
and execute the following code anonymously:
Yup.debugTestException();
I get:
- How does
new YupException('This is only a test.');
compile without having the constructorpublic YupException(string ErrorMessage){ ... }
? - Similarly, how does YupException compile when I haven't implemented any of the methods mention in
Yup.debugTestException()
? - How do those unwritten methods and constructor actually execute / How do I get away implementing an Interface while not implementing any of it's methods let alone call an undefined constructor??
Here's primary documentation from Salesforce, but what does SFDC do on the backend that makes my inner-compiler-alarm go off?