Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
public interface IAnimal
{
void Speak();
}
public class Dog : IAnimal
{
public void Speak()
{
Console.WriteLine("Dog barks");
}
}
public class Cat : IAnimal
{
public void Speak()
{
Console.WriteLine("Cat meows");
}
}
class Program
{
static void Main()
{
IAnimal a1 = new Dog();
IAnimal a2 = new Cat();
a1.Speak();
a2.Speak();
}
}Coding works best on desktop or with an external keyboard.