You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
666 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Composite
{
class Client
{
public static void HowToTest()
{
Directory dir = new Directory("Folder");
File file1 = new File("a1.doc");
File file2 = new File("a2.doc");
File file3 = new File("a3.doc");
Directory sub = new Directory("SubFolder");
dir.AddChildren(file1);
dir.AddChildren(file2);
dir.AddChildren(file3);
dir.AddChildren(sub);
DisplayNode(file2, dir);
}
static void DisplayNode(params Node[] component)
{
foreach (Node item in component)
{
item.Display();
}
}
}
}