logo

Crowdly

Browser

Add to Chrome

public interface INode { int Size(); } public sealed class FileLeaf : INode { ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

public interface INode { int Size(); }

public sealed class FileLeaf : INode

{

private readonly int _bytes;

public FileLeaf(int bytes) => _bytes = bytes;

public int Size() => _bytes;

}

public sealed class FolderComposite : INode

{

private readonly List

_children = new();

public void Add(INode n) => _children.Add(n);

public int Size() => _children.Sum(c => c.Size());

}

Який патерн ілюструє цей код?

0%
0%
100%
0%
More questions like this

Want instant access to all verified answers on do.ipo.kpi.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome