示例#1
0
        static void Main(string[] args)
        {
            IDBFunktioner[] arr = new IDBFunktioner[4];

            arr[0] = new Hund();
            arr[1] = new Ubåd();
            arr[2] = new Hund();
            arr[3] = new Ubåd();

            foreach (IDBFunktioner item in arr)
            {
                item.Gem();
            }

            Console.ReadLine();


            Hund h = new Hund();
            Ubåd u = new Ubåd();

            IDBFunktioner idb = h;

            IDBFunktioner idb2 = u;

            gemDims(idb);

            gemDims(idb2);

            List <IDBFunktioner> idbList = new List <IDBFunktioner>();

            idbList.Add(new Hund {
                Navn = "Valter"
            });

            idbList.Add(new Ubåd {
                Nummer = 1337, Tubine = 2.2
            });

            idbList.Add(new Hund {
                Navn = "Guffy"
            });

            foreach (IDBFunktioner item in idbList)
            {
                item.Gem();
            }


            Console.ReadLine();
        }
示例#2
0
 static void gemDims(IDBFunktioner idbFunk)
 {
     idbFunk.Gem();
 }