Hiding Inherited Members - CSharp Custom Type

CSharp examples for Custom Type:virtual

Introduction

A base class and a subclass may define identical members. For example:

public class A      { public int Counter = 1; }

public class B : A  { public int Counter = 2; }

The new modifier does nothing more than suppress the compiler warning that would otherwise result:

public class A     { public     int Counter = 1; }
public class B : A { public new int Counter = 2; }

Related Tutorials