First of all let me just say that I am new to nHibernate so if the answer to this is obvious forgive me. I have an abstract base class with all it's members abstract.
public abstract class BallBase
{
public abstract RunsScored { get; }
public abstract IsOut { get; }
public abstract IsExtra { get; }
public abstract GetIncrement();
}
And concrete implementations like
public class WideBall : BallBase
{
public override RunsScored
{
private int m_RunsScored = 1;
public WideBall(): base()
{ }
public WideBall(int runsScored) : base()
{
m_RunsScored = runsScored;
}
public override int RunsScored
{
get
{
return m_RunsScored;
}
}
public override bool IsOut
{
get
{
return false;
}
}
public override bool IsExtra
{
get
{
return true;
}
}
public override int GetIncrement()
{
// add 0 to the balls bowled in the current over
// a wide does not get added to the balls bowled
return 0;
}
}
}
I want to use nHibernate to persist the concrete classes, but apparently all public members of the class need to be virtual. Is there any way to continue with my base class approach?