vincent wrote:
"Is that possible to define in PHP a class C1 in terms of a class C2 defined in terms of class C1?"
That would be difficult, because C1 exists of C2, but C2 exists of C1, so C1 must exist before C2 can be created, but C1 can only be created if C2 exists... the chicken and the egg.
What exactly are you trying to do?
If you're just looking for an object that contains other objects, then just create an object with a var and stick another object in that var and stick another object in the var in the object in that var etc...
What I'm trying to do is what in other language is called "forward declaration",
I mean a class TPerson with a property carOwned of type TCar (meaning it should be called a constructor of TCar) and a class TCar with a property Owner of type TPerson.
If I can do this in Delphi, C, C++, man, do not say it's not possible to make it with PHP!
In Delphi you just say:
class TCar; //this is forward declaration
class TPerson =
name:string;
car: TCar;
;
class TCar =
model:string;
owner:TPerson;
;