Base (super) class in C#
Forums:
class Shape {
public int LineCount { get; set; }
public Shape(int lineCount) {
LineCount = lineCount;
}
}
class Square : Shape {
public int SideLength { get; set; }
public Square(int sideLength) : base(4) {
SideLength = sideLength;
}
}
var square = new Square(5);
//square.LineCount is 4
- Log in to post comments