如果我从一个基类继承并希望将继承类的构造函数中的某些东西传递给基类的构造函数,我该怎么做?
例如,
如果我从Exception类继承,我想做这样的事情:
class MyExceptionClass : Exception
{
public MyExceptionClass(string message, string extraInfo)
{
//This is where it's all falling apart
base(message);
}
}
Run Code Online (Sandbox Code Playgroud)
基本上我想要的是能够将字符串消息传递给基本的Exception类.