using System;
namespace Exercise_8_2
{
class EntryPoint
{
static void Main()
{
Tester t = new Tester();
t.Run();
}
}
}
class Tester
{
public void Run()
{
Dyr Animals = new Dyr();
Animals.DisplayAllAnimals();
int TheMonkeys = 0;
int TheSealions = 0;
int TheZebras = 0;
Animals.GetAllAnimals(ref TheMonkeys, ref TheSealions , ref TheZebras); //Pass the ints by refence
Console.WriteLine(" one {0} two {1} three {2}", TheMonkeys, TheSealions, TheZebras);
}
}
class Dyr // the zoo keeper control class
{
private int Monkeys = 3;
private int Sealions = 5;
private int Zebras = 8;
public void DisplayAllAnimals()
{
Console.WriteLine("we have {0} Monkeys {1} Sealions and {2} zebars", Monkeys , Sealions , Zebras );
}
public void GetAllAnimals( ref int TheMonkeys , ref int TheSealions , ref int TheZebras )
{
TheMonkeys = Monkeys; // Takes references to these ints
TheSealions = Sealions;
TheZebras = Zebras;
}
}