Unfortunately, I can not find the original project that led me to this issue. Perhaps this would ask a little more.
EDIT: I found the original project that I saw at: http://mews.codeplex.com/SourceControl/changeset/view/63120#1054567 with a specific implementation at: http://mews.codeplex.com/SourceControl/changeset/ view / 63120 # 1054606
Suppose I have an abstract class with a specific implementation that does something useful:
abstract class AbstractClass
{
public virtual int ConvertNumber(string number)
{
string preparedNumber = Prepare(number);
int result = StringToInt32(number);
return result;
}
protected abstract string Prepare(string number);
protected virtual int StringToInt32(string number)
{
return Convert.ToInt32(number);
}
}
sealed class ConcreteClass : AbstractClass
{
protected override string Prepare(string number)
{
return number.Trim();
}
public override int ConvertNumber(string number)
{
return base.ConvertNumber(number);
}
}
It is as simple as it gets. Now, in the code that I saw on the Internet, the author implemented inheritance by inheriting the Abstract class from the most derived type, for example:
abstract class AbstractGenericClass<TGenericClass>
where TGenericClass : AbstractGenericClass<TGenericClass>
{
public virtual int ConvertNumber(string number)
{
string preparedNumber = Prepare(number);
int result = StringToInt32(number);
return result;
}
protected abstract string Prepare(string number);
protected int StringToInt32(string number)
{
return Convert.ToInt32(number);
}
}
sealed class ConcreteGenericClass : AbstractGenericClass<ConcreteGenericClass>
{
protected override string Prepare(string number)
{
return number.Trim();
}
public override int ConvertNumber(string number)
{
return base.ConvertNumber(number);
}
}
? , , ATL (- vtable?) .
IL , .
?