Class members hiding in C#
Forums:
private abstract class Shape {
public void Fill(Color color) {
//Fill implementation
}
}
class Square : Shape {
public new void Fill(Color color) {
//New fill implementation
}
}
var square = new Square();
square.Fill(Color.Red);
//Use Square fill implementation
((Shape) square).Fill(Color.Red);
//Use Shape fill implementation
- Log in to post comments