Exemple #1
0
        public static GrandChild operator+(GrandChild a, GrandChild b)
        {
            GrandChild c = new GrandChild();

            c.Name     = b.Name;
            c.LastName = a.LastName;
            return(c);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Child c = new Child();

            c.SetName("Anna");
            c.SetLastName("Book");
            GrandChild gc = new GrandChild("Michael");

            gc.SetLastName("Andersson");
            GrandChild gc2 = new GrandChild("Simon");
            GrandChild p   = gc + gc2;

            Console.WriteLine(p.GetName());
        }