title: creating groovy classes
body: <p>I'm trying to learn how to create simple groovy classes, which are not domain classes.  I want to create a set of classes (and their objects) in my software but have no intention of saving to a database.  Specifically, I have a question about how to create a class which has a property that is a list of a second class.  like this:</p>
  
  <pre><code>class oParent{
      def fName
      def lName
      def listOfChildren
  }
  class oChild{
      def propertyOne
      def propertyTwo
  }
  </code></pre>
  
  <p>So, with this example, I can create an object of each like this:</p>
  
  <pre><code>def p = new oParent();
  def cOne = new oChild();
  def cTwo = new oChild();
  
  p.fName ="SomeName"
  p.lName ="some Last Name"
  
  cOne.propertyOne = "a"
  cOne.propertyTwo = "b"
  
  cTwo.propertyOne = "c"
  cTwo.propertyTwo = "d"
  </code></pre>
  
  <p>So, how do i add each of the children objects (cOne and cTwo) to the parent object p).  Once added, how would i then traverse the parent class's children's property and, for example, print all the propertyTwo properties for all children classes?</p>