Esempio n. 1
0
        private static void Main()
        {
            Adam   adam  = Adam.GetInstance();
            Eve    eve   = Eve.GetInstance(adam);
            Male   seth  = new Male("Seth", eve, adam);
            Female azura = new Female("Azura", eve, adam);
            Male   enos  = new Male("Enos", azura, seth);

            Console.WriteLine(((Human)enos).Name);
            Console.ReadKey();
        }
Esempio n. 2
0
        public static Eve GetInstance(Adam adam)
        {
            _adamInstance = adam ?? throw new ArgumentNullException();

            return(_eveInstance ??= new Eve(_adamInstance));
        }
Esempio n. 3
0
 private Eve(Adam adam)
 {
     _adamInstance = adam;
 }