Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0139 Shadow inherited members

During the inheritance we may shadow the members from the parent class. For example, class Shape{ int Width; } class Rectangle: Shape{ int Width; } The Width from the Rectangle shadows the Width from Shape. To mark the hidden fields C# uses new modifier. class Shape{ int Width; } class Rectangle: Shape{ new int Width; }