I understand we cannot access derived class members from base class in C#. But, in one of our other applications written in java with hibernate, I see that the application allows and does retrieve derived class members from base class. For eg.,
Classes:
public class base{ public string a{get;set;}}
public class derived:base{public string b{get;set;}}
Method
//Gets all base records
public List<base> GetAllbaseRecords()
{
}
public bool IsExist
{
foreach(var base in GetAllbaseRecords())
{
string c= base.b; //Compile error in c#
}
}
But, it does not throw an error and infact shows the data in java. What's the logic I'm missing here?