0xD*_*EEF 3 c# interface class call
interface ILol
{
void LOL();
}
class Rofl : ILol
{
void ILol.LOL()
{
GlobalLOLHandler.RaiseROFLCOPTER(this);
}
public Rofl()
{
//Is there shorter way of writing this or i is there "other" problem with implementation??
(this as ILol).LOL();
}
}
Run Code Online (Sandbox Code Playgroud)
lad*_*dge 10
您已经明确地实现了接口,通常您不需要这样做.相反,只需隐式实现它,并像任何其他方法一样调用它:
class Rofl : ILol
{
public void LOL() { ... }
public Rofl()
{
LOL();
}
}
Run Code Online (Sandbox Code Playgroud)
(注意您的实施也需要公开.)