shouldn't the output of the above code be "DemoC++". We are using super.s, so the upper class XClass has no knowledge about the subclass YClass. Any help please and takes for your time
i guess you are using the super keyword wrong...super is used when a variable in the current class shadows the variable in the superclass.....try this example...then may you will understand....am not sure if am right....what i have done here is created a new string s in the YClass.....
Dejan is absolutely right.....bang on target...we have changed the value of superclass's variable and using super.s we are trying to find out the value of s..which is c#....
Concept that is being show is that at the time of object creation initializwer are executed and that the super class intializer in run before the subclass. Actually the intializer is run before it own constructor is run.
Ajit
Post by:autobot
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, the permaculture playing cards