How to create an instance of two classes at the same time?
class, delphi
Solution
The proper syntax should be:
C1 := TClass1.Create;
C2 := TClass2.Create;
Problem
This is my problem - shortly: ``` var c1:TClass1; c2:TClass2; begin c1 := c1.Create; c2 := c2.Create; //<<Exception; end; ``` Both classes inherit from TObject.If they don't inherit then I can't use the debugger in the class so I have to use TObject. My real problem is that I have to create the instance of the second class inside a function in the instance of the first class.I can't find a way to free the instance of the first class while i'm inside it. It seems I can't have more than one class that inherits from TObject,is that the problem? How do I fix my code,any suggestions? Thanks in advance!