Hello guys here i got a question about accessing the private member from base class here is my code
The derived class function can't access the value of base class returned function.What is the problemCode:using System; class emp { private int x; public void getdata() { y=int.parse(Console.ReadLine()); } public int setdata() { return y; } } class person:emp { int x; public void calculate() { x=base.setdata(); Console.WriteLine(x); } } public static void Main() { emp e=new emp(); person p=new person(); e.getdata(); p.calculate }



LinkBack URL
About LinkBacks



