After you have created or cloned a TXBase object, you can throw the object in two ways:
- Use the throw keyword followed by the object name, as follows:
TXBase
xobj(
"Some exception...");
- Call the exception object's Throw function, as follows:
TXBase
xobj(
"Some exception...");
This last method provides strict type safety when you throw the exception. It also provides a polymorphic interface when throwing the exception, allowing the function that catches a TXBase-derived exception object to treat the object as a TXBase object, regardless of what it actually is.