Ejemplo n.º 1
0
        }                     //Private constructor

        public static Eiland GetInstance()
        {
            if (_uniekeEiland == null)
            {
                _uniekeEiland = new Eiland();
            }
            return(_uniekeEiland);
        }
Ejemplo n.º 2
0
        static void Main(string[] args) //SINGLETON , SIMPLE FACTORY zijn toegepast
        {
            Eiland eiland = Eiland.GetInstance();

            using (StreamReader reader = new StreamReader("EilandInwoners.txt"))
            {
                EilandInwonerFactory factory = new EilandInwonerFactory();
                string regel = reader.ReadLine();
                while (regel != null)
                {
                    eiland.AddInwoner(factory.MaakEilandInwoner(regel.Substring(0, 1), regel.Substring(2)));
                    regel = reader.ReadLine();
                }

                eiland.VolkaanUitBarsting();
            }
        }