10.1 Générique introduction
Welcome in this third part about generics We are going to see the static fields and the methods To know if we define a static field in a generic class It will be unique for all instances. Whatever the value of the parameter For example We will make a static field So nbrChild Equal to 1 for example And we will make a method. Which will display the number of children We will increment the number of children and then display it. And there So we will return in our hand. We'll call our method. ChildNumber And you will see that. we'll have a value of 2 and 3 2 and 3 since each instance we create our ChildNumber will be incremented And of course, the object must be an object of type family now, you must know that a static field can not be of a type to appear so it will be forbidden to do example static D we will put home so as you see there will be an error during compilation, I hope that you have understood this introduction on the staic concerning the generics in the next course we are going to carry out method with generics therefore Soon