When the Derived22 object, d, is created, the following sequence takes place:
1. Instance variables in the Base22 class and those in the Derived22 class are initialised to their default values(x,y, and z are initialised to 0).
2. The Base22 class constructor is called. This calls the init() function. Since the object 'this' is now of the Derived22 class, its init() method is called.
3. Inside the init() method, the values are assigned which are :- y = 4, z = 5.
4. Once the Base22 class initialisation has been done, the Derived22 class initialisation is started.
5. In this process, any explicit assignments done to the instance variables is carried out. As z has been assigned 3, this is carried out. But y has not been given any explicit value. It therefore keeps its earlier value of 4. That's how
you get the result.