public class clsb { public string subjectName = ""; public string mainsubject() { return subjectName; } } public class clsA : clsb { public string subjectName = ""; public string Allsubject() { return subjectName; } } private void getdata() { clsA obj = new clsA(); //base and derived class obj.subjectName = "English"; string A1 = obj.mainsubject(); string A2 = obj.Allsubject(); }