以下单例类工作正常,
public class Elvis
{
private static Elvis elvis = new Elvis();
private Elvis()
{
}
public static Elvis Instance()
{
return elvis;
}
}
但是,当我更改return elvis;
为时return this.elvis
,我得到non-static variable this cannot be referenced from a static context
. 为什么是这样?