Beispiel #1
0
    public void Visit(GroupB group)
    {
        group.ParentGroup = _parent;
        var visitor = new GroupVisitor(group);

        foreach (var item in group.Groups)
        {
            item.Accept(visitor);
        }
    }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Code to oversee CIA.
            // The following line won't compile because GroupA isn't accessible outside
            // the CIAAssembly. Congress can't get at GroupA over at CIA at all.

            // CIAAssembly.GroupA groupA = new CIAAssembly.GroupA();

            // Class Congress can access GroupB because it's declared public.
            // GroupB is willing to admit to knowing the secret, but they're
            // not telling ... except for a small hint.
            GroupB groupB = new GroupB();

            groupB.DoSomethingWithSecretX();

            // Wait for user to acknowledge results.
            Console.WriteLine("Press Enter to terminate...");
            Console.Read();
        }