Object as Instance Variable of an Object

From: Christian Schwarzer (ch.schwarzer_at_gmx.ch)
Date: 04/29/04


Date: 29 Apr 2004 07:45:30 -0700

Hi,

I'm new to OTcl and would like to do the following:
To have an instance variable that is itself an object.
In Java this would look somehow like this:

class Father{
  public int age;
  public String name;
}

class Family{
  public Father father;
  public Family () {this.father = new Father();}
}

myFamily = new Family();

//access to instance variables
myFamily.father.age // and so on

How can I construct the same in OTcl and how to access instance variables
that are themselves objects and how to access the instant variables of the
instant variable of Family (myFamiliy.father.age).

Thanks a lot for your help,

/Christian