Hi
I would like to create an abstract base class that inherits from a generic type so that my subclasses can dictate what type to inherit from.
For example:
Doing this would allow me to do things such as the following:
and
Doing this would allow me to get around the single inheritance restriction and prevent me having to duplicate code in my web applications.
Although the examples above are web application related, the question is a C# question so I reckon this is the correct forum to post my question.
Is this possible?
TIA
Smeat
I would like to create an abstract base class that inherits from a generic type so that my subclasses can dictate what type to inherit from.
For example:
Code:
/// <summary>
/// Provides common functions.
/// </summary>
abstract class CommonBase<T>: T
{
protected CommonBase()
{
}
}
Doing this would allow me to do things such as the following:
Code:
public partial class StandardMaster1 : CommonBase<System.Web.UI.MasterPage>
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
and
Code:
public partial class Login: CommonBase<System.Web.UI.Page>
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Doing this would allow me to get around the single inheritance restriction and prevent me having to duplicate code in my web applications.
Although the examples above are web application related, the question is a C# question so I reckon this is the correct forum to post my question.
Is this possible?
TIA
Smeat