c# - Can i access a concrete method of an abstract class in direct child class? -
is there way can access concrete method's of abstract class in direct child class below
abstract class parameterbase { public void test() { string name = "testname"; console.writeline(name); } } public class parameter1 : parameterbase { //i need call(access) test() method here i.e print "testname" in console }
now know can create instance of child class type parameterbase , access test() method there in parameterbase() below
parameterbase pb = new parameter1(); pb.test();
you have maintain accessibility level while inheriting class. can :
abstract class parameterbase { public void test() { string name = "testname"; console.writeline(name); } } class parameter1 : parameterbase { void getvalue() { parameter1 pb = new parameter1(); pb.test(); } }
Comments
Post a Comment