Console.WriteLine(Human.objectCount);
Console.ReadLine();
Human bob = new Human("Bob", 18);
Human bobby = new Human("Bobby", 16);
Human bibby = new Human("Bibby", 11);
class Human
{
private string name {get; set;}
private int age {get; set;}
public static int objectCount;
public Human(string name, int age)
{
this.name = name;
this.age = age;
objectCount++;
Console.WriteLine($"{this.name}'s age is {this.age} and he has connected.");
Dictionary<Human, Human> nameAndAge = new Dictionary<Human, Human>();
for (int counter = 0; counter < objectCount; counter++)
{
nameAndAge.Add(Human.name, Human.age);
}
}
}
Console.WriteLine(Human.objectCount);
Console.ReadLine();
Human bob = new Human("Bob", 18);
Human bobby = new Human("Bobby", 16);
Human bibby = new Human("Bibby", 11);
class Human
{
private string name {get; set;}
private int age {get; set;}
public static int objectCount;
public Human(string name, int age)
{
this.name = name;
this.age = age;
objectCount++;
Console.WriteLine($"{this.name}'s age is {this.age} and he has connected.");
Dictionary<Human, Human> nameAndAge = new Dictionary<Human, Human>();
for (int counter = 0; counter < objectCount; counter++)
{
nameAndAge.Add(Human.name, Human.age);
}
}
}