class ParentClass
{
private List<string> _childClassList;
public ParentClass()
{
///Create the new list object in constructor
_childClassList = new List<string>();
}
/*******************************
* Here are all the behaviors
* of the ParentClass object
*******************************/
public int GetChildClassCount()
{
return _childClassList.Count;
}
public void AddToChildList(string val)
{
_childClassList.Add(val);
}
public string GetLongestStringInChildClassList()
{
string longestString = String.Empty;
foreach(string member in _childClassList)
{
if(member.Length > longestString.Length)
longestString = member;
}
return longestString.ToUpper();
}
}
|