Neumann_Janos_Verseny/fordulo_3/Program/Doboz.cs
2025-03-14 11:19:14 +01:00

43 lines
925 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program
{
internal class Doboz
{
public char Type { get; set; }
public Doboz Children = null;
public Doboz Parent = null;
public Doboz(char Type) {
this.Type = Type;
}
public void AddChildren(Doboz doboz)
{
doboz.Parent = this;
this.Children = doboz;
}
public void PrintBoxContent(int indent = 0)
{
string indentStr = "";
for (int i = 0; i < indent; i++)
{
indentStr += "->";
}
Console.WriteLine($"{indentStr}{this.Type}");
if (this.Children != null)
{
this.Children.PrintBoxContent(indent + 1);
}
}
}
}