I am confused again. I am not modifying the parent class if I instantiate a new B or C class ?
C c = new C ("Peter");
(Why would I want to pass that name to the Parent or Base (super) class ? What on earth is achieved by doing that ?)
Thanks for your attention ;)
Can someone please explain to me why the constructor of the B and C class is calling Super(name) ?
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Gellert Varga
20 December 2021, 21:02
I don't think it makes sense to declare the same variable in the descendant class as already exist in the parent class.
In my opinion it also makes no sense to have constructors overwrite the same variable all the time.
I can only see the option that CG was intended to confuse us...
Or: to teach us to recognize the total nonsense:)
Or: to be able to toss aside all the confusing parts of this task, and to be able to concentrate the only thing: the Serializable property can be inherited.
+2