class Compound : Shape { protected List shapes; public Compound() { shapes = new List(); position = new Point(10000, 10000); } public void CalculatePosition() { int intLeftMostPoint = shapes[0].GetLeftMostPoint; int intTopMostPoint = shapes[0].GetTopMostPoint; foreach (Shape sh in shapes) { intLeftMostPoint = sh.GetLeftMostPoint(); intTopMostPoint = sh.GetTopMostPoint(); if (intLeftMostPoint < this.X) { this.position = new Point(intLeftMostPoint, this.Y); } if (intTopMostPoint < this.Y) { this.position = new Point(this.X, intTopMostPoint); } } }