Untitled
unknown
csharp
a year ago
992 B
6
Indexable
//Program
public static void SetAllChildrenInMonth()
{
foreach(Month month in months)
{
foreach(Child child in children)
{
if(child.month == month)
{
month.AddChild(child);
}
}
}
}
//Month
namespace Checking
{
public class Month
{
public string Name;
public Child[] Children;
public Month(string name, Child child)
{
Name = name;
if (Children.Length == 0)
{
Children = new Child[1];
Children[0] = child;
}
}
public Month(string name)
{
Name = name;
}
public void AddChild(Child child)
{
Child[] tempChild = new Child[Children.Length+1];
Children.CopyTo(tempChild, 1);
tempChild[0] = child;
Children = tempChild;
}
}
}Editor is loading...
Leave a Comment