Logo 
Search:

C# Forum

Ask Question   UnAnswered
Home » Forum » C#       RSS Feeds

warning make use of "new" keyword.

  Asked By: Chigaru    Date: Sep 16    Category: C#    Views: 911
  

class Class1
{
static void Main(string[] args)
{
Foo b1 = new Bar();
b1.Response();
Console.ReadLine();
}
}
abstract class Foo
{
public void Response()
{
Console.WriteLine("In Foo");
}
}
class Bar : Foo
{
public void Response()
{
Console.WriteLine("In Bar");
}
}

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jimmy Abp     Answered On: Sep 16

I am getting warning  that you should make  use of "new" keyword

 
Answer #2    Answered By: Rickey Scott     Answered On: Sep 16

// It will show warning  if "new" keyword  is not used.
class Bar : Foo
{
 public   new void  Response()
{
Console.WriteLine("In Bar");
}
}

Any idea why it is happening?

 
Didn't find what you were looking for? Find more on warning make use of "new" keyword. Or get search suggestion and latest updates.




Tagged: