title: Delphi: Using function from main class in a subclass
body: <p>On the new side of writing classes and have a little problem which I have tried researching but still no answer.</p>
  
  <p>I want to create one instance of a class which creates multiple subclasses which creates subclasses of their own. The idea is to use code like this in main program:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  var
    Temp : Integer;
  begin
    MainClass := TMainClass.Create(Form1);
    Temp := MainClass.SubClass1.SubSubClass1.SomeValue;
  end;
  </code></pre>
  
  <p>The main class looks like this and is created in seperate file:</p>
  
  <pre><code>  TMainClass = class(TObject)
      private
        FSubClass1 : TSubClass1;
      public
        ValueFromAnySubClass : Integer;
        property SubClass1 : TSubClass1 read FSubClass1 write FSubClass1;
        procedure SetSomeValueFromMainClass(Value : Integer);
    end;
  ...
  ...
  ...
  procedure TMainClass.SetSomeValueFromMainClass(Value : Integer);
  begin
    ValueFromAnySubClass := Value;
  end;
  </code></pre>
  
  <p>The sub class also in seperate file:</p>
  
  <pre><code>  TSubClass1 = class(TObject)
      private
        FSubSubClass1 : TSubSubClass1;
      public
        property SubSubClass1 : TSubSubClass1 read FSubSubClass1 write FSubSubClass1;
    end;
  </code></pre>
  
  <p>And now for the sub sub class also in seperate file:</p>
  
  <pre><code>  TSubSubClass1 = class(TObject)
    private
      SomeValue : Integer;
      function  GetSomeValue : Integer;
      procedure SetSomeValue(Value : Integer);
    public
      property SomeValue : Integer read GetSomeValue write SetSomeValue;
    end;
  ...
  ...
  ...
  procedure TSubSubClass1.SetSomeValue(Value : Integer);
  begin
    SetSomeValueFromMainClass(Value); &lt;&lt;&lt; Error Here &lt;&lt;&lt;
  end;
  </code></pre>
  
  <p>How do I get to use the functions and procedures from the main class in my sub classes?</p>