I am confusing about "new" keyword,tell me about new
which class(means base class or derived class) method can hide new keyword.
Inheritance
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Danatas GerviRank #4,152 · 361 reputationPosted Sep 17, 2009, 12:09 AM EDT
The new key word also allows hiding the method of base class in derived class.
You can do it any how (even without new) by giving the same name of method in derived class, but the compiler will warn you "method …. Hides …. Etc "
So, "new" – is the way to say to compiler, that you really want it, this is not bug.