====== Inheritance in datasheets ====== Inheritance is an essential notion in the creation of a set of DS, to avoid repeating itself. This makes it possible to inherit characteristics of a parent DS, and even to rewrite on some, and even to make it possible not specifying "everything again" when we realize a set of DS have common characteristics. For example, imagine an object ''my object'' that can have four characteristics A, B, C and D, having between 0 and 10 as values. One could have: A = 2 B = 3 C = 4 D = 5 A = 2 B = 3 C = 4 D = 9 One sees that A, B and C are identical in the two different objects, one could thus simplify the task by making a parent DS: A = 2 B = 3 C = 4 Then we call it the other two: parent = my_object D = 5 parent = my_object D = 9 In addition to not allowing repeating itself, it allows to pass on any change in a "parent" to all of his/her children. One can nevertheless decide to specify a difference(with respect to the "parent"), which makes it possible to modify a common characteristic. parent = my_object B = 7 D = 5 In DS, parenting is done through the call: It is advisable to organize the [[en:rcdsnomenclature | DS nomenclature]] in order to be able to identify it quickly, and also to quickly identify a parent of a complete card.. by doing it like this: * Put an underscore "_" at the beginning of parents' names to make them come up first in a directory listing; * Use underscores "_" for name fields, like for example the code shipped with RC. This lets you know which parameters are populated and which ones are absent if the nomenclature is explicit. Of course, a parent DS can call one or more parents, etc. \\ Attention to inheritances in cascade(as in CSS). {{tag>datasheet }}