static member cannot be accessed with an instance reference; qualify it with a type name instead
11,583
I got the answer. static method name should be different.
public static string getMem()
{
return MemberFactory.Current.getMember();
}
This will fix the issue. Thank god.
Related videos on Youtube
Comments
-
Anna.P almost 2 years
I have abstract class
public abstract class MemFactory { public abstract bool test(); public virtual string getMember() { string validMember = "test"; return validMember; } }
I have inherited the same in another child class
public class MemberFactory : MemFactory { private static readonly MemberFactory instance = new MemberFactory(); static MemberFactory() { } public static MemberFactory Current { get { return instance;} } public static string getMember() { return MemberFactory.Current.getMember(); } }
When i am accessing the base class method its giving me
"static member cannot be accessed with an instance reference; qualify it with a type name instead"
Can anyone help?