Object inside an object

What is it called when an object has an object of the same type within itself?

Example:

public class Foo{

     public Foo myFoo;

}
+3
source share
4 answers

I do not think there is any specific name for this. Although this concept is used in many different general programming constructs. For example, when you present a graph, tree, or linked list, nodes usually have links to other nodes with which they are linked / connected.

+14
source

, Foo " ". , , .. , , , , . SQL- , , , . WHERE FilterNode, , Node (, ):

public interface Node { }

public class FilterNode implements Node {
    public Node underlyingNode;
    public Condition filterCondition;
}

, , . , , ( ).

+5

Recursive localization .... :)

+4
source

To add to what Kibby said, this is a type of compound template

+1
source

Source: https://habr.com/ru/post/1710625/


All Articles