Say I define a class that has as a member a variable of the same type as itself.
public class Abc {
private Abc p;
}
This actually works, much to my surprise.
Why I think it shouldn't: creating an instance of Abc
, it contains a variable of type Abc
, which contains a variable of type Abc
, which contains a variable of type Abc
, which .....
Obviously I'm wrong, could someone enlighten me as to how?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…