Click here to Skip to main content
15,889,116 members
Home / Discussions / C#
   

C#

 
AnswerRe: Finding if given point lies inside the polygon Pin
AB777120-Mar-06 21:33
AB777120-Mar-06 21:33 
GeneralRe: Finding if given point lies inside the polygon Pin
sulakshana_b1120-Mar-06 21:45
sulakshana_b1120-Mar-06 21:45 
GeneralRe: Finding if given point lies inside the polygon Pin
AB777121-Mar-06 0:00
AB777121-Mar-06 0:00 
AnswerRe: Finding if given point lies inside the polygon Pin
Guffa21-Mar-06 0:49
Guffa21-Mar-06 0:49 
QuestionMethod versioning Pin
Jeevan Jyoti20-Mar-06 19:08
Jeevan Jyoti20-Mar-06 19:08 
AnswerRe: Method versioning Pin
Ahmad Mahmoud [candseeme]20-Mar-06 19:32
Ahmad Mahmoud [candseeme]20-Mar-06 19:32 
GeneralRe: Method versioning Pin
Jeevan Jyoti20-Mar-06 19:49
Jeevan Jyoti20-Mar-06 19:49 
AnswerRe: Method versioning Pin
Bob Stanneveld20-Mar-06 21:24
Bob Stanneveld20-Mar-06 21:24 
Hello,

Consider the following code example:
// Some class that you can use
public class Foo
{
    public virtual string DoFoo() { return "Foo.DoFoo"; }
    public virtual string DoBar() { return "Foo.DoBar"; }
}
 
public class DerivedFromFoo
{
    public override string DoFoo() { return "DerivedFromFoo.DoFoo"; }
    public new      string DoBar() { return "DerivedFromFoo.DoBar"; } 
}
 
public class Main
{
    public static void Main(string[] args)
    {
        DerivedFromFoo derivedFromFoo = new DerivedFromFoo();
        Console.WriteLine(derivedFromFoo.DoFoo());
        Console.WriteLine(derivedFromFoo.DoBar());
 
        Foo foo = (Foo)derivedFromFoo;
        Console.WriteLine(foo.DoFoo());
        Console.WriteLine(foo.DoBar());
        
        Console.ReadLine();
    }
}

When you run the above code, you'll see the following output:
DerivedFromFoo.DoFoo
DerivedFromFoo.DoBar
DerivedFromFoo.DoFoo
Foo.DoBar


You see that you hide the base class DoBar with a new function. Typecasting the derived class to the base class calls the original function. When you use override, you replace the implementation of the base class with a completely new one.

Hope this helps. Big Grin | :-D


Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
QuestionBasic Question about threading Pin
kpkr20-Mar-06 15:53
kpkr20-Mar-06 15:53 
AnswerRe: Basic Question about threading Pin
Vikram A Punathambekar20-Mar-06 16:42
Vikram A Punathambekar20-Mar-06 16:42 
AnswerRe: Basic Question about threading Pin
AB777120-Mar-06 17:58
AB777120-Mar-06 17:58 
GeneralRe: Basic Question about threading Pin
CWIZO20-Mar-06 19:38
CWIZO20-Mar-06 19:38 
QuestionCellphone software Pin
ab2moro20-Mar-06 15:21
ab2moro20-Mar-06 15:21 
AnswerRe: Cellphone software Pin
mcljava21-Mar-06 4:55
mcljava21-Mar-06 4:55 
QuestionC# Plugin for Internet Explorer? Pin
sim*20-Mar-06 14:21
sim*20-Mar-06 14:21 
AnswerRe: C# Plugin for Internet Explorer? Pin
K.sundar20-Mar-06 17:21
K.sundar20-Mar-06 17:21 
QuestionGetting the command line as a whole Pin
Brett Slaski20-Mar-06 12:57
Brett Slaski20-Mar-06 12:57 
AnswerRe: Getting the command line as a whole Pin
George L. Jackson20-Mar-06 15:17
George L. Jackson20-Mar-06 15:17 
GeneralRe: Getting the command line as a whole Pin
Brett Slaski21-Mar-06 1:43
Brett Slaski21-Mar-06 1:43 
Questiondrawing onto a WEbbrowsercontrol?? Pin
t_holm20-Mar-06 11:00
t_holm20-Mar-06 11:00 
AnswerRe: drawing onto a WEbbrowsercontrol?? Pin
thrakazog20-Mar-06 11:19
thrakazog20-Mar-06 11:19 
GeneralRe: drawing onto a WEbbrowsercontrol?? Pin
Judah Gabriel Himango20-Mar-06 12:39
sponsorJudah Gabriel Himango20-Mar-06 12:39 
QuestionNamespace issues Pin
thrakazog20-Mar-06 10:51
thrakazog20-Mar-06 10:51 
AnswerRe: Namespace issues Pin
mcljava20-Mar-06 12:37
mcljava20-Mar-06 12:37 
GeneralRe: Namespace issues Pin
thrakazog20-Mar-06 13:09
thrakazog20-Mar-06 13:09 

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.