How to extend a class with a member of its own type?
问题 Suppose we need to implement different types of tree with a class called "BaseNode" from which other type of Nodes are derived and it suppose to have an instance variable called parent of its own type, generally it looks like: class BaseNode{ //...some fields BaseNode parent; //...other methods } Now if I am going to derive Node for AVL tree with more members: class AVLNode extends BaseNode{ //...other useful stuff } the original parent (& left & right )node members will still be type