От: | rameel | https://github.com/rsdn/CodeJam | |
Дата: | 19.05.07 10:59 | ||
Оценка: | 12 (1) |
Type 'Sample.PersonAccessor' from assembly 'Sample, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' tried to override method 'GetName' but does not implement or inherit that method.
Signature of the body and declaration in a method implementation do not match. Type: 'Sample.PersonAccessor'. Assembly: 'Sample, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
.method family hidebysig virtual instance string GetName() cil managed
.method family hidebysig newslot virtual instance string GetName() cil managed
using System;
using System.Console;
namespace Sample
{
public class BizEntityAccessor[T, A]
where T : BizEntity[T]
where A : BizEntityAccessor[T, A]
{
protected virtual GetName() : string { "OK!"; }
protected virtual SelectByKey(_: int): T { null; }
}
public class BizEntity[T] where T : BizEntity[T]
{
}
public class Person : BizEntity[Person]
{
public ID : int { get; set; }
public Name: string { get; set; }
}
public class PersonAccessor: BizEntityAccessor[Person, PersonAccessor]
{
protected override GetName() : string // (1)
{
"Ooops";
}
//protected override SelectByKey(_: int): Person //(2)
//{
//WriteLine("Ooops");
//null;
//}
}
module Program
{
Main() : void
{
Console.WriteLine(typeof(PersonAccessor));
_ = Console.ReadKey();
}
}
}