I would like to add Parents and Childs between object of the same class.
Do you mean you're writing a class and you want each instance to have properties Parent and Child (or Parents and Children?) that can contain another instance of the class? [How many parents and how many children would you need/want an instance of the class to support?]
Would you also need to allow Parent and/or Child to contain something other than an instance of the class, to reflect that an object has no parent and/or no children?
Can I create properties 'Parent' and 'Child' with method setParent
There's no function named setParent in MATLAB. [A few classes in MathWorks products have defined such a method, but I haven't checked to see what if anything those methods are doing in addition to setting a property.]
which -all setParent
But you can have classes with properties that contain other objects. See for example the linked list class example in the documentation. Before you write such a class, you probably want to read this other documentation page as well.
You could define a method named setParent or a property set method named set.Parent if you wanted, but often you don't need to. You could use regular indexing operations to set or get the property value, as shown in the Property Access Syntax section on this documentation page.