コード例 #1
0
ファイル: Program.cs プロジェクト: K1kk3rt/S1.4_OO
        static void Main(string[] args)
        {
            PersoonStruct p1 = new PersoonStruct("Simon", 40);
            PersoonClass  p2 = new PersoonClass("Chris", 50);

            Console.WriteLine("struct persoon: " + p1.naam + ", " + p1.leeftijd);
            Console.WriteLine("class persoon: " + p2.naam + ", " + p2.leeftijd);
            Console.WriteLine();
            WijzigLeeftijd(ref p1);
            WijzigLeeftijd(p2);
            Console.WriteLine("struct persoon: " + p1.naam + ", " + p1.leeftijd);
            Console.WriteLine("class persoon: " + p2.naam + ", " + p2.leeftijd);
            Console.WriteLine();
            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: K1kk3rt/S1.4_OO
 static void WijzigLeeftijd(PersoonClass p)
 {
     p.leeftijd++;
 }