Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
interface IEatable
|
||||
{
|
||||
void Eat();
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
class FoodBox<T> where T : IEatable
|
||||
{
|
||||
List<T> food;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
class Apple : IEatable
|
||||
{
|
||||
public void Eat()
|
||||
{
|
||||
System.Console.WriteLine("Apple has been eaten");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic
|
||||
|
||||
class FoodMakingBox<T> where T : IEatable, new()
|
||||
{
|
||||
List<T> food;
|
||||
|
||||
void Make(int numberOfFood)
|
||||
{
|
||||
this.food = new List<T>();
|
||||
for (int i = 0; i < numberOfFood; i++)
|
||||
{
|
||||
this.food.Add(new T());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue