as I am new in programming, I just wanted to know in the following code why we wrote
const char* what() instead of char what below in 6th line.
second, why someone wrote MyException& e not just MyException e why we used reference over here in the Catch block. please enlighten me as I am a little confused over references and const references something.......
#include <iostream>
#include <exception>
using namespace std;
class MyException: public exception{
    public:
const char* what(){
return "C++ exception";}
};
int main()
{
    try{
    throw MyException();}
    catch(MyException e){
    cout<<"Myexception caught"<<endl;
    cout<<e.what()<<endl;
    }
}
 
    