What potential issues can arise when overloading methods like getMessage() in custom exception classes in PHP?
Overloading methods like getMessage() in custom exception classes can lead to confusion and unexpected behavior, as the getMessage() method is already defined in the base Exception class. To avoid this issue, it is recommended to use a different method name for custom messages in your exception classes.
class CustomException extends Exception {
public function getCustomMessage() {
return $this->getMessage();
}
}