public class Adapter<T>
{
public virtual ??? DoSomething()
{
...
}
}
public class AdaptedString : Adapter< String >
{
public override AdaptedString DoSomething()
{
...
}
}
* This source code was highlighted with Source Code Highlighter .
public class Adapter<TThis,T>
{
public virtual TThis DoSomething()
{
...
}
}
public class AdaptedString : Adapter< AdaptedString , String >
{
public override AdaptedString DoSomething()
{
...
}
}
* This source code was highlighted with Source Code Highlighter .
public class Adapter<TThis,T>
where TThis : Adapter<TThis, T>
{
protected int _field;
...
public bool Compare( TThis obj )
{
return _field == obj._field;
}
}
public class AdaptedString : Adapter< AdaptedString , String >
{
...
}
* This source code was highlighted with Source Code Highlighter .
class TypeA : Adapter<TypeA, string >
class TypeB : Adapter<TypeA, string > // Bug!
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/69813/