Re:Goodbye, shitty Car extends Vehicle object-orientation tu...
by A321321 on Friday June 24, 2022 @07:16AM
(#31860121)
No, that’s not how new works. Any method in the base class will still call the “hidden” method.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu...
by smcl on Friday June 24, 2022 @07:32AM
(#31860248)
Ah yeah you're right :)
Re:Goodbye, shitty Car extends Vehicle object-orientation tu...
by fabian2k on Friday June 24, 2022 @07:02AM
(#31860039)
Using new is still very different from using override, there are real differences in behaviour there. Though I never used "new", it's usually described as a really bad idea unless you know what you're doing, I never saw the need to use this.
You can with "new", no?
So with Bar we have inherited Think(), but have overridden Say(). Ok technically the MSDN docs will say that we've "hidden" the inherited method Say(), but the effect here is that we've overridden something not marked "virtual"edit: Oops yeah I'm talking rubbish, see replies for more info :D