Yes and No.
Yes because a new modifier hides inherited members from a base class member,
ex:
public class baseClass {
public void SomeMethod() {}
}
public class derivedClass : baseClass {
new public void SomeMethod() {}
}
This member (SomeMethod) declared with the new modifier, will hide the same method from the base class.
No because a new operator creates objects and call constructors of the respective class.
ex: classA objA = new classA();
Also read: http://msdn.microsoft.com/
Hope that helps.
Main Topics
Browse All Topics





by: Frosty555Posted on 2009-02-14 at 22:49:54ID: 23643856
The "New" keyword is used to set the variable equal to a new instance of an object. Normally object variables are initially set to NULL until they are explicitly given a value.
If you want to hide the members of a base class, use the "Private" or "Protected" keywords before the declaration. E.g.
Private MyObject oSomething;
Private means nobody can see it except the class itself. Protected means only the class and it's derived subclasses can see it, but a caller can't.