Click here to Skip to main content
       

C#

 
QuestionADAM LDAP Authentification via user distinguishedName Pinmembermappy7501730-Jan-13 22:41 
QuestionSubreport Pinmembertheezin30-Jan-13 22:16 
AnswerRe: Subreport PinprotectorPete O'Hanlon30-Jan-13 22:22 
QuestionHow to write c# version of Delphi's Abort procedure PinmemberXiaoming Qian30-Jan-13 18:46 
AnswerRe: How to write c# version of Delphi's Abort procedure PinmvpRichard MacCutchan30-Jan-13 22:07 
AnswerRe: How to write c# version of Delphi's Abort procedure PinmemberShameel31-Jan-13 0:18 
AnswerRe: How to write c# version of Delphi's Abort procedure Pinmemberjschell31-Jan-13 8:21 
Question"new" to hide base class implementation - is it useless? [modified] Pinmemberdevvvy30-Jan-13 18:17 
Take a simple example from here[^]
 
The following example, try remove "new" from B.Yell, it makes no difference (except Compiler will bitch about it).
 
Let me know if I am mistaken!

class Program
{
static void Main(string[] args)
{
try
{
A ref1 = new A();
A ref2 = new B();
B ref3 = new B();
 
ref1.Y(); <-- A.Yell
ref2.Y(); <-- B.Yell
ref3.Y(); <-- Always B.Yell, regardless whether you decorated Yell() with "new" or not! (This makes the keyword useless)
}
catch (Exception Ex)
{
Console.WriteLine("Main.Exception - " + Ex.ToString());
}
 
return;
}
 
class A
{
public void Yell()
{
Console.WriteLine("A.Yell");
}
}
 
class B : A
{
public new void Yell()
{
Console.WriteLine("B.Yell");
}
}
}

dev


modified 31-Jan-13 0:26am.

AnswerRe: "new" to hide base class implementation - is it useless? PinmemberKeld Ølykke30-Jan-13 20:03 
GeneralRe: "new" to hide base class implementation - is it useless? Pinmemberdevvvy30-Jan-13 20:11 
GeneralRe: "new" to hide base class implementation - is it useless? PinmemberKeld Ølykke30-Jan-13 23:45 
GeneralRe: "new" to hide base class implementation - is it useless? Pinmemberdevvvy31-Jan-13 15:33 
GeneralRe: "new" to hide base class implementation - is it useless? PinmemberKeld Ølykke31-Jan-13 20:56 
GeneralRe: "new" to hide base class implementation - is it useless? Pinmemberdevvvy1-Feb-13 14:54 
AnswerRe: "new" to hide base class implementation - is it useless? [modified] Pinmembermarkovl30-Jan-13 21:20 
GeneralRe: "new" to hide base class implementation - is it useless? Pinmemberdevvvy31-Jan-13 15:30 
AnswerRe: "new" to hide base class implementation - is it useless? [modified] PinmemberShameel31-Jan-13 1:07 
AnswerRe: "new" to hide base class implementation - is it useless? PinmvpAbhinav S31-Jan-13 6:25 
GeneralRe: "new" to hide base class implementation - is it useless? Pinmemberdevvvy31-Jan-13 15:40 
GeneralRe: "new" to hide base class implementation - is it useless? PinmvpAbhinav S31-Jan-13 22:26 
GeneralRe: "new" to hide base class implementation - is it useless? Pinmemberdevvvy1-Feb-13 14:56 
QuestionCatching unhandled ThreadAbortException from Main? Pinmemberdevvvy30-Jan-13 14:56 
AnswerRe: Catching unhandled ThreadAbortException from Main? PinmemberAndy41130-Jan-13 22:37 
AnswerRe: Catching unhandled ThreadAbortException from Main? PinmemberShameel31-Jan-13 3:49 
AnswerRe: Catching unhandled ThreadAbortException from Main? Pinmemberjschell31-Jan-13 8:29 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 11 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid