411 REFERENCE · Wikibooks
C Sharp Programming/Keywords/new
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Keywords new
__TOC__
The new keyword has two different meanings:
It is an operator that requests a new instance of the class identified by its argument.
It is a modifier that explicitly hides a member.
As an example, see the code below:
public class Car
{
public void go()
{
}
}
Car theCar = new Car(); // The new operator creates a Car instance
int i = new int(); // Identical to … = 0;
public class Lamborghini : Car
{
public new void go() // Hides Car.go() with this method
{
}
}