Base (super) class in Java
Forums:
class Shape {
public int lineCount;
public Shape(int lineCount) {
this.lineCount = lineCount;
}
}
class Square extends Shape {
public int sideLength;
public Square(int sideLength) {
super(4);
this.sideLength = sideLength;
}
}
Square square = new Square(5);
//square.lineCount is 4
- Log in to post comments