using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InterImp
{
class Program
{
interface Inter<T> //定义泛型接口Inter
{
void show(T t); //约定功能show
}
class InterImpA : Inter<String> //定义接口Inter的子类InterImpA,明确泛型类型为String
{
public void show(String t) //子类InterImpA重写方法show,指明参数类型为String
{
Console.WriteLine(t);
}
}
class InterImpB<T> : Inter<T> //定义接口Inter的子类InterImpB,直接声明泛型
{
public void show(T t) //子类InterImpB重写方法show,参数类型为泛型
{
Console.WriteLine(t);
}
}
st
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InterImp
{
class Program
{
interface Inter<T> //定义泛型接口Inter
{
void show(T t); //约定功能show
}
class InterImpA : Inter<String> //定义接口Inter的子类InterImpA,明确泛型类型为String
{
public void show(String t) //子类InterImpA重写方法show,指明参数类型为String
{
Console.WriteLine(t);
}
}
class InterImpB<T> : Inter<T> //定义接口Inter的子类InterImpB,直接声明泛型
{
public void show(T t) //子类InterImpB重写方法show,参数类型为泛型
{
Console.WriteLine(t);
}
}
st