Click here to Skip to main content
15,885,537 members
Home / Discussions / C#
   

C#

 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy31-Jan-13 15:33
devvvy31-Jan-13 15:33 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
Keld Ølykke31-Jan-13 20:56
Keld Ølykke31-Jan-13 20:56 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy1-Feb-13 14:54
devvvy1-Feb-13 14:54 
AnswerRe: "new" to hide base class implementation - is it useless? Pin
markovl30-Jan-13 21:20
markovl30-Jan-13 21:20 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy31-Jan-13 15:30
devvvy31-Jan-13 15:30 
AnswerRe: "new" to hide base class implementation - is it useless? Pin
Shameel31-Jan-13 1:07
professionalShameel31-Jan-13 1:07 
AnswerRe: "new" to hide base class implementation - is it useless? Pin
Abhinav S31-Jan-13 6:25
Abhinav S31-Jan-13 6:25 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy31-Jan-13 15:40
devvvy31-Jan-13 15:40 
Abhinav S wrote:
A bigger difference is made in the line A ref2 = new B();


You are wrong, I suggest you try it yourself. As pointed out by Markovl and myself this post, removing "new" makes no difference besides silencing compiler warning.

Also, check out MSDN:[^]

When used as a modifier, the new keyword explicitly hides a member inherited from a base class. When you hide an inherited member, the derived version of the member replaces the base-class version. Although you can hide members without the use of the new modifier, the result is a warning. If you use new to explicitly hide a member, it suppresses this warning and documents the fact that the derived version is intended as a replacement.


This is just another useless facility only relevant in enterprise interviews.
dev

GeneralRe: "new" to hide base class implementation - is it useless? Pin
Abhinav S31-Jan-13 22:26
Abhinav S31-Jan-13 22:26 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy1-Feb-13 14:56
devvvy1-Feb-13 14:56 
QuestionCatching unhandled ThreadAbortException from Main? Pin
devvvy30-Jan-13 14:56
devvvy30-Jan-13 14:56 
AnswerRe: Catching unhandled ThreadAbortException from Main? Pin
Andy41130-Jan-13 22:37
Andy41130-Jan-13 22:37 
AnswerRe: Catching unhandled ThreadAbortException from Main? Pin
Shameel31-Jan-13 3:49
professionalShameel31-Jan-13 3:49 
AnswerRe: Catching unhandled ThreadAbortException from Main? Pin
jschell31-Jan-13 8:29
jschell31-Jan-13 8:29 
GeneralRe: Catching unhandled ThreadAbortException from Main? Pin
devvvy31-Jan-13 15:43
devvvy31-Jan-13 15:43 
GeneralRe: Catching unhandled ThreadAbortException from Main? Pin
jschell2-Feb-13 7:53
jschell2-Feb-13 7:53 
AnswerRe: Catching unhandled ThreadAbortException from Main? Pin
Keld Ølykke31-Jan-13 21:15
Keld Ølykke31-Jan-13 21:15 
QuestionGo to finally in try block Pin
vanikanc30-Jan-13 7:25
vanikanc30-Jan-13 7:25 
AnswerRe: Go to finally in try block Pin
Jibesh30-Jan-13 7:35
professionalJibesh30-Jan-13 7:35 
GeneralRe: Go to finally in try block Pin
vanikanc30-Jan-13 7:37
vanikanc30-Jan-13 7:37 
GeneralRe: Go to finally in try block Pin
Jibesh30-Jan-13 7:41
professionalJibesh30-Jan-13 7:41 
GeneralRe: Go to finally in try block Pin
vanikanc30-Jan-13 7:42
vanikanc30-Jan-13 7:42 
GeneralRe: Go to finally in try block Pin
Jibesh30-Jan-13 7:44
professionalJibesh30-Jan-13 7:44 
GeneralRe: Go to finally in try block Pin
devvvy31-Jan-13 15:44
devvvy31-Jan-13 15:44 
AnswerRe: Go to finally in try block Pin
Eddy Vluggen30-Jan-13 7:45
professionalEddy Vluggen30-Jan-13 7:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.